AutoSize Label Font

I have label inside RelativeLayout

       relativeLayout.Children.Add(label1,
          Constraint.RelativeToParent((parent) =>
          {
              return parent.Width / 2; 
          }),
          Constraint.RelativeToParent((parent) =>
          {
              return parent.Width / 2;
          }),
          Constraint.RelativeToParent((parent) =>
          {
              return parent.Width * 0.005;
          }),
          Constraint.RelativeToParent((parent) =>
          {
              return parent.Width * 0.05;
          }));

As you can see Label size is proportional to RelativeLayout size.
But not Font size.

Is there any way to make some binding, for example.

Or to change font size imperatively in a way like:

      for (int i=0;i<relativeLayout.Children.Count; i++)
        {
            View v = relativeLayout.Children[i];
            if (v.GetType().Name == "Label")
            {
                // change font size here.
            }
        }

Answers

Sign In or Register to comment.