i want to add a switch button as an item in options menu, preferably with its title beside him, like how the checkbox appears in the picture below
i tried this code for the menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/itemSwitch"
android:title="Switch!"
app:actionViewClass="android.widget.Switch"
app:showAsAction="always" />
<item android:id="@+id/itemSettings"
android:title="Settings"
/>
<item
android:id="@+id/itemCheckable"
android:checkable="true"
android:title="im checkable" />
</menu>
and it looked like this: always showAsAction
but thats not what i want, i want it as an item of the menu. so i removed app:showAsAction="always" (or wrote app:showAsAction="never", it did the same) and then thats what happened: dont showAsAction
as u see now it doesnt show the switch but only its title. if i removed the title, it just turned blank.
is there a way to show a switch as an item of a menu at all? like just like the checkbox item - but with a switch instead.
thankss!