Android: Showing Action Bar menu items depending on ViewPager

前端 未结 4 1420
深忆病人
深忆病人 2021-01-02 01:09

I am having trouble getting the following piece of code to work out. I have a viewpager with 3 fragments, and I want a search icon to only show up on one. I s

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 01:50

    You can implement onCreateOptionsMenu() in your Fragment and set 'setHasOptionsMenu(true)' for the fragment

提交回复
热议问题