[英]Android custom Action bar issue
我正在使用Custom ActionBar
並使用以下代碼:
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
LayoutInflater inflator = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
customView = inflator.inflate(R.layout.action_bar_title, null);
actionBar.setCustomView(customView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME);
actionBar.setDisplayHomeAsUpEnabled(true);
但是在右側面臨額外的空間問題,請檢查所選區域的屏幕截圖。
一個月前,我發現這個解決方案之后我也遇到了這個問題。 有一個技巧你可以解決這個問題,我知道這不是正確的答案,但通過一些邏輯,你可以得到你想要的。
<ImageView
android:id="@+id/addItem"
android:layout_width="35dp"
android:layout_height="35dp"
android:padding="10dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:src="@drawable/add" />
或做一件事你可以把你的添加和信息按鈕添加到linearlayout並給出正確的對齊為true,我不確定這一點,但你應該嘗試一次。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.