xml - customized of android switch -




greetings dear fellow developers, working on android application in have use switch view little bit customized view, switch working fine, supposed view getting on device screen not, here switch code

<switch         android:id="@+id/addrecordrandomfasting"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_centerinparent="true"         android:checked="false"         android:showtext="true"         android:textoff="random"         android:texton="fasting"         android:textsize="@dimen/activity_text_size"         android:thumb="@drawable/switch_thumb"         android:thumbtextpadding="50dp"         android:track="@drawable/switch_track" /> 

and switch_thumb

<selector xmlns:android="http://schemas.android.com/apk/res/android">  <item android:state_checked="true">     <color android:color="#00ff00" /> </item>  <item>     <color android:color="#ff0000" /> </item> 

, switch_track

<shape xmlns:android="http://schemas.android.com/apk/res/android">  <size android:height="48dp" />  <solid android:color="#ccc" /> 

view showing me in android studio design tab

enter image description here

and getting on device

enter image description here enter image description here

as can see, switch on , off has different width , text position,i have been struggling couple of days, appreciated... in advance





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -