How to display menu item with icon and text in AppCompatActivity

前端 未结 9 1814
遥遥无期
遥遥无期 2020-11-29 05:11

I tried different combinations in xml file:



        
9条回答
  •  执笔经年
    2020-11-29 05:51

    You can use following code for establishing your purpose. No need to make it programmatic. You can trick in menu.xml file.

    menu.xml

    
    
    
    
    
        
            
        
    
    

    In above code, we've used menu inside of item. In inside menu, we've defined our overflow menu which we want with icon. Just remember to use app:showAsAction="always" in outside item tag.

提交回复
热议问题