SubMenu Layout Android

2020-05-03 12:23发布

问题:

I have read that submenus in Android do not support icons. I was wondering if this has changed, or if there is a similar way to produce a "submenu" that does support icons?

Currently This is My Submenu:

Here Is the XML File For It:

<menu>
    <item android:id="@+id/facebook_icon"
        android:title="Share With Facebook"
        android:icon="@drawable/ic_menu_facebook" />

    <item android:id="@+id/twitter_icon"
        android:title="Share With Twitter"
        android:icon="@drawable/ic_menu_twitter" />         
</menu>

I want it to look like this (If you have any ideas I would appreciate hearing them!):

回答1:

You can create your own dialog instead of the submenu, and make it look any way you want.