我正在尝试设置我的应用程序的自定义视图,我制作的布局没有填满整个操作栏.我尝试了很多样式设置,但没有一个适合我.
这是我的活动代码
View view = getLayoutInflater().inflate(R.layout.actionbar_customized_home, null);
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(view);
Run Code Online (Sandbox Code Playgroud)
这里的布局设置为视图
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/actionbar_color"
>
![enter image description here][1]
<ImageView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:src="@drawable/logo"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
甚至像导航器这样的菜单项的背景如何将我的自定义视图作为背景颜色?
我非常感谢你的帮助
android android-styles android-actionbar-compat android-actionbaractivity