0
votes

I have an android custom renderer for a Xamarin Forms EntryCell control. As far as I can tell the EntryCell is a combination of an input and a label. I would like to modify the following properties:

  1. Font of the EntryCell label
  2. Color of the EntryCell Label
  3. TextSize of the EntryCell Label
  4. Color of the text of the input control

I have been able to change the colour and size of the EntryCell input using the code below

public class CustomEntryCellRenderer : EntryCellRenderer
{
    protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
    {
        var cell = base.GetCellCore(item, convertView, parent, context) as EntryCellView;

        if (cell != null)
        {
            var textField = cell.EditText as TextView;

            textField.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);
            textField.SetTextColor(Color.FromHex("#FF8800").ToAndroid());

        }

        return cell;
    }

}

Can you please let me know how I access the label part of the EntryCell?

1

1 Answers

1
votes

There is no standard way to access label part of EntryCell. You can use SetLabelTextColor to set its color. If you really need to change the font as well, you could use ViewCell instead of EntryCell and define Label and Entry separately inside its template. In this case you probably will be able to set all the things you need without using custom renderer.