I am developing an Android application that employs a standard ActionBar.
on a certain screen i have a Filter icon that is conditionally required,
depending on characteristics of the data being displayed, e.g. some data is filterable
Others not.
i cannot find any methods on actionbar that look likely candidates for programmaticaly
hiding an actionbar action icon.
how can i enable/disable an actionbar action icon?
Or
how can i hide/unhide an actionbar action icon?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Try ActionBar.getActionBar.hide();
You can do it by overriding the onPrepareOptionsMenu() method. Here is a small example
However, This method is only called whenever you click the menu button in the action bar. If you've any icons on the action bar (except menu button), clicking on that will not trigger the OnPrepareOptionsMenu() method. In order to trigger this method manually you can use the invalidateOptionsMenu() in your methods. like this
As I understand, you need to remove the icon that shows on the action bar top left.
You can do that with this simple line of code:
And if you like to get rid of the app name try:
Hope this helps.
You can also try this:
It will hide the icon and title.
Don't forget your import:
Good Luck
Have a look at this, it shows how to change menu items at runtime.
You could for example save the menu as a member variable of your Activity inside onCreateOpionsMenu() and then do something like this:
when you want to change something on a specific menu item.