getActionView() of my MenuItem return null

后端 未结 5 1270
囚心锁ツ
囚心锁ツ 2020-11-30 13:41

I just would like to tweak the View of an ActionBar MenuItem by code.

Unfortunately, it seems that getActionView always return null!

My code:



        
5条回答
  •  伪装坚强ぢ
    2020-11-30 14:03

    you should use

    app:actionLayout="@layout/menu_actionbar_basket"
    

    thats the trick if you use

    android:actionLayout="@layout/menu_actionbar_basket"
    

    you would always get null exception in default toolbar.

提交回复
热议问题