I have used custom rendering for entry cell in xamarin forms for IOS and android. How can I set left and right padding for the entry cell.
My custom entry cell in PCl :
<local:MyEntryCell Placeholder="Placeholder" PlaceholderColor="Grey" TextColor="Black"/>
MyEntryCell is the custom name of my entry cell.
In my PCL I have:
public class MyEntryCell:Entry
{
}
In IOS:
namespace CustomEntry.IOS
{
public class MyEntryCellRenderer:EntryRenderer
{
// override onElementChanged
}
}
In Android :
namespace CustomEntry.Droid
{
public class MyEntryCellRenderer:EntryRenderer
{
// override onElementChanged
}
}
Use this for setting padding to an entry cell:
Padding in IOS :
Control.LeftView = new UIView(new CGRect(0,0,15,0));
Control.LeftViewMode = UITextFieldViewMode.Always;
Control.RightView = new UIView(new CGRect(0, 0, 15, 0));
Control.RightViewMode = UITextFieldViewMode.Always;
Padding in Android:
Control.SetPadding(15, 15, 15, 0);
Accordingly, you can set the value to make text start from specific position.