getActionView() of my MenuItem return null

后端 未结 5 1265
囚心锁ツ
囚心锁ツ 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:06

    If your debug build is working without any issues and issue is only with release build then this may be because of proguard configuration. If you have enabled proguard in your application then add below line to proguard-rules.pro

    -keep class android.support.v7.widget.SearchView { *; }
    

提交回复
热议问题