自定义操作栏中留下左边的Android黑色空间? [英] Custom action bar leaves black space on the left android?
本文介绍了自定义操作栏中留下左边的Android黑色空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个自定义的操作栏
I have created a custom action bar
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 code
The java code
android.support.v7.app.ActionBar bar = getSupportActionBar();
bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
bar.setCustomView(R.layout.action_layout);
截图
正如你可以看到它留下了黑色的商场空间,在屏幕的左上角。我不希望它。我希望它是纯白色。
As you can see it leaves a mall black space to the top left of the screen. I don't want it. I want it to be pure white.
需要做什么来实现这一点。
What needs to be done to achieve this.
推荐答案
尝试调用setDisplayShowHomeEnabled()以虚假的。
Try to call setDisplayShowHomeEnabled() with false.
<一个href="http://developer.android.com/reference/android/app/ActionBar.html#setDisplayShowHomeEnabled%28boolean%29" rel="nofollow">http://developer.android.com/reference/android/app/ActionBar.html#setDisplayShowHomeEnabled%28boolean%29
这篇关于自定义操作栏中留下左边的Android黑色空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文