I'm working on a project where I am currently trying to put a switch inside the applications action bar (as in the wi-fi settings : http://tinypic.com/r/2l8vt35/6 )
How can this be done?
I'm working on a project where I am currently trying to put a switch inside the applications action bar (as in the wi-fi settings : http://tinypic.com/r/2l8vt35/6 )
How can this be done?
Add
android:actionLayout
to your<item>
in your menu XML resource, pointing to a layout XML resource that has yourSwitch
. Then, usegetActionView()
on theMenuItem
to register listeners on changes in the switch.Note that
Switch
only works on API Level 14 and higher.