[英]Custom ActionBar and overflow menu
我正在實現自定義ActionBar,如何處理溢出菜單(此處右側的3點圖標: http : //developer.android.com/images/ui/actionbar.png )? 如果沒有硬件菜單按鈕,則溢出菜單應該可見-但是如何檢測到?
我沒有使用系統ActionBar,因為我需要自定義行為。
ViewConfiguration.get(context).hasPermanentMenuKey()
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
e.printStackTrace();
}
}
菜單按鈕有些過時 ,也許您想重新考慮並堅持使用溢出菜單? 順便說一句,您知道http://actionbarsherlock.com/嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.