我可以在actionbar
中添加自定義視圖。我的應用程序支持2.3版本,所以我使用ActionbarActivity
。現在我的查詢是從actionbar
中刪除應用程序圖標,只有回家的圖標,即後面的圖像。刪除帶自定義視圖的操作欄圖標並顯示主頁向上按鈕
我嘗試了很多在搜索時發現的選項。但它不適用於自定義視圖。
編輯
ActionBar actionBar = getSupportActionBar();
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.RIGHT
| Gravity.CENTER_VERTICAL);
View customNav = LayoutInflater.from(this).inflate(
R.layout.custom_action_view, null); // layout which contains
actionBar.setCustomView(customNav, lp);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(Color
.parseColor("#a40404")));
幫我出這個問題。提前致謝。
沒有回家圖標無法顯示按鈕。 –
顯示一些代碼.... – Namy
@DoctororDrive是不可能的? – BSKANIA