Android DeviceDefault Switch button -
i need device default switch (api lvl 14) button. have switch buttons in app, want them device default switch buttons, not android. how can that? tried change theme of application have custom 1 used custom title bar , if try change theme (e.g. theme.devicedefault) force close because of custom title. highly appreciated.
this how switch looks (for device):
may looking togglebutton (api lvl 1), or swith (api lvl 14)?
update: okay, can use imageview
, can handle clicks. , in xml:
<imageview android:layout_width="100dp" android:layout_height="100dp" android:background="@drawable/my_swich" />
in my_swith.xml in drawable folder:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/selectedimage" /> <item android:drawable="@drawable/normalimage" /> </selector>
and final, in code need set onclicklistener
image. when onclick
event on image need this:
iv.setselected(!iv.isselected());
and custom(you own toogle) hope correct understand question.
Comments
Post a Comment