Custom Layout menu item appears blank if showAsAction = never

I am trying to add SwitchCompat to the overflow menu using the following code:

main.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
       android:id="@+id/menu_dummy_content"
       android:title=""
       android:actionViewClass="android.support.v7.widget.SwitchCompat"
       app:showAsAction="never"
       app:actionLayout="@layout/menu_item_switch"/>

    <!-- TODO: Delete this after bug fix-->
    <item
       android:id="@+id/menu_dummy_content_2"
       android:title="Second Title"
       app:showAsAction="never"/>
</menu>

Layout for menu_item_switch:

<android.support.v7.widget.SwitchCompat
    xmlns:android="http://schemas.android.com/apk/res/android"

    android:id="@+id/menu_item_switch_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:text="@string/menu_item_dummy_tasks"
    android:layout_centerVertical="true"/>

If I do app: showAsAction = "ifRoom" or something else, the switch looks fine [/ strong>] and the listeners work fine. But , as soon as showAsAction like never before . The switch looks white / blank , but onOptionsItemSelected says the menu click is menu_dummy_content.

, TextView , . - ?

+4
1

showAsAction , .

, ...

 <item
   android:id="@+id/menu_dummy_content"
   android:title=""
   android:actionViewClass="android.support.v7.widget.SwitchCompat"
   app:showAsAction="never"
   app:actionLayout="@layout/menu_item_switch"/>

...

android:title="First Title"
+1

All Articles