Adding TextView in Picker via PickerRenderer
![](https://techprofile.blob.core.windows.net/images/oANs8AKxrEWKxfeHYUt2-Q.png?8D8955)
DiamondKesha
31
Reputation points
Hello everyone.
After adding TextView to the Picker via the PickerRenderer, the text of the selected item is shifted to the right. How i can fix this?
Image of the Picker (where the red lines are indents that should not be):
Code:
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
var textV = new TextView(this.Context);
textV.Text = "Title";
textV.TextSize = 14;
textV.SetTextColor(Android.Graphics.Color.Black);
Control.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(textV), null, null, null);
}
private BitmapDrawable GetDrawable(TextView textV)
{
var bitmap = Bitmap.CreateBitmap(100, 100, Bitmap.Config.Argb8888);
var canvas = new Canvas(bitmap);
textV.Layout(0, 0, 80, 100);
textV.Draw(canvas);
var bitmapDrawable = new BitmapDrawable(Context.Resources, bitmap);
return bitmapDrawable;
}