我创建了一个自定义操作栏
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Choose"
android:textColor="#000000"
android:id="@+id/mytext"
android:textSize="18sp" />
</LinearLayout>
Java代码
android.support.v7.app.ActionBar bar = getSupportActionBar();
bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
bar.setCustomView(R.layout.action_layout);
截图
正如你可以看到它留下了黑色的商场空间,在屏幕的左上角。 我不希望它。 我希望它是纯白色。
需要做,以实现这一目标是什么。