can I use a compatible action bar AND a fragment in the same activity?

后端 未结 4 1902
-上瘾入骨i
-上瘾入骨i 2021-02-07 04:30

OK, I\'ve been extending my activities to

extends ActionBarActivity

My main menu page

extends FragmentActivity
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-07 04:55

    Do you have menu items for your Fragments? Use your own app namespace instead of android for app:showAsAction and app:actionLayout, etc.

    To add your namespace to the XML use this line in the menu tag

    xmlns:app="http://schemas.android.com/apk/res-auto"
    

    E.g.

    
        
    
    

    Note the app:showAsAction rather than android:showAsAction

提交回复
热议问题