user interface - How to add a visual prefix to an entry in Xamarin Forms? -


say want add number prefix based on country, phone entry? 1 on image: enter image description here how can achieve that?

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.

enter image description here

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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -