Skip to content Skip to sidebar Skip to footer

Switch On Appcompatactivity Not Showing

I'm trying to add a Switch widget on my ActionBar but when I try to implement it it doesn't show or if it does, my ActionBart title dissapears. What I've done is : I've created a

Solution 1:

Try using app:actionLayout too:

<item
    android:id="@+id/switchId"
    android:title=""
    app:showAsAction="ifRoom"
    app:actionLayout="@layout/swipe_wifi"
    />

It should be noted also that you are casting the view to android.widget.Switch, while in your layout you have a android.support.v7.widget.SwitchCompat (and that is a good choice, since Switch was added in API14).

Post a Comment for "Switch On Appcompatactivity Not Showing"