![](/img/trans.png)
[英]How to hide ActionBar but still show Navigation menu icon on top left
[英]How to hide menu icon from ActionBar
如何從ActionBar隱藏菜單按鈕(垂直的3個點),我創建了自定義操作欄,但某些設備仍在ActionBar右側顯示默認菜單圖標。
我只想隱藏菜單按鈕(3個垂直點),而不是菜單功能。
這是屏幕截圖
它被稱為Overflow
,一種隱藏它的方法是重寫onPrepareOptionsMenu
方法並找到溢出按鈕並將其可見性設置為false。
樣品:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// if nav drawer is opened, hide the action items
menu.findItem(R.id.menu_settings).setVisible(false);
return super.onPrepareOptionsMenu(menu);
}
獲取操作欄最右側的菜單圖標
或者:
You have defined items to appear in the overflow area, in which case, get rid of those, or
Your android:targetSdkVersion is under 11, in which case, raise it
請參閱這篇文章以了解更多信息http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.