user interface - How to add a visual prefix to an entry in Xamarin Forms? -
i this
<stacklayout orientation="horizontal" backgroundcolor="gray"> <label text="+995 |" backgroundcolor="transparent" /> <editor text="699999999" backgroundcolor="transparent"></editor> </stacklayout>
a horizontal stacklayout label prefix , editor entry.
as can see using same approach app in order display arrow down icon next picker.
var datectrl = new noborderpicker() { verticaloptions = layoutoptions.center, fontsize = device.getnamedsize(namedsize.default, typeof(label)) * fontsizes.editformcontrolfactor, heightrequest = 40, backgroundcolor = color.white, horizontaloptions = layoutoptions.fillandexpand, }; var icon = new iconview() { source = "ic_keyboard_arrow_right_black_24dp", foreground = palette._019, verticaloptions = layoutoptions.center, horizontaloptions = layoutoptions.end, margin = new thickness(0, 0, 5, 0) }; var stack = new stacklayout() { orientation = stackorientation.horizontal, children = { datectrl, icon } };
the noborderpicker
custom renderer in order remove border picker control
[assembly: exportrenderer(typeof(noborderpicker), typeof(custompicker))] namespace thesissfa.droid.renderers { public class custompicker : pickerrenderer { protected override void onelementchanged(elementchangedeventargs<picker> e) { base.onelementchanged(e); if (control != null) { var custombg = new gradientdrawable(); custombg.setcolor(android.graphics.color.transparent); custombg.setcornerradius(3); control.setbackground(custombg); var custdatepicker = (noborderpicker) this.element; this.control.textsize = (float)custdatepicker.fontsize; } } } }
Comments
Post a Comment