java - Number picker doesn't show properly as designer -
i have issues number picker control in android studio. control aren't displayed on real device when run application. number picker has no gray background color, no "+" / "-" buttons displayed, transparent ?
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" > <expandablelistview android:layout_width="wrap_content" android:layout_height="342dp" android:id="@+id/lvtranexp" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_above="@+id/numberpicker" android:layout_alignparenttop="true" /> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentbottom="true" android:layout_below="@+id/lvtranexp" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparentright="true" android:layout_alignparentend="true"> <numberpicker android:scalex="0.5" android:scaley="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/numberpickerstartday" android:layout_below="@+id/lvtranexp" android:layout_toleftof="@+id/numberpickerstartday" android:layout_tostartof="@+id/numberpickerstartday" android:solidcolor="#da9c9c" /> <numberpicker android:scalex="0.5" android:scaley="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/numberpickerstartmonth" android:layout_below="@+id/lvtranexp" android:layout_torightof="@+id/numberpickerstartday" android:layout_toendof="@+id/numberpickerstartday" android:solidcolor="#895353" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:text="start date" android:textcolor="#e9e97619" android:id="@+id/textview5" android:layout_below="@+id/lvtranexp" android:layout_alignbottom="@+id/numberpicker1" android:layout_marginleft="40dp" android:layout_gravity="center" /> </linearlayout> </relativelayout>
and java code number picker:
view contentview = inflater.inflate(r.layout.activity_transactions, null); numberpicker startday = (numberpicker)contentview.findviewbyid(r.id.numberpickerstartday); numberpicker startmonth = (numberpicker)contentview.findviewbyid(r.id.numberpickerstartmonth); string []days = new string[31]; for(int =0;i<days.length;i++){ days[i]=integer.tostring(i+1); } string []months = new string[12]; for(int =0;i<months.length;i++){ months[i]=integer.tostring(i+1); } startday.setminvalue(1); startday.setmaxvalue(31); startday.setwrapselectorwheel(false); startday.setdisplayedvalues(days); startday.setvalue(1); startmonth.setminvalue(1); startmonth.setmaxvalue(12); startmonth.setwrapselectorwheel(false); startmonth.setdisplayedvalues(months); startmonth.setvalue(1);
thanks in advance
Comments
Post a Comment