我不知道这是如何填补上来了,但有没有这样的填充,直到我更新了我的SDK来21。 这是我的code:
I don't know how this padding came up, but there's no such padding until I updated my SDK to 21. Here's my code:
mActionBar = getSupportActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
actionBarView = LayoutInflater.from(this).inflate(R.layout.title_bar_layout, null);
mActionBar.setCustomView(actionBarView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mActionBar.setDisplayShowCustomEnabled(true);
有谁知道如何解决这个问题?谢谢。
Does anyone know how to solve this ? thanks.
编辑:
由于支持库 22.1.x
的最后一次更新,如果你不使用工具栏
的属性有是动作条的风格的一部分。例如
since the last update of Support library 22.1.x
, if you are not using ToolBar
the attributes have to be part of the ActionBar style. E.g
<style name="MyStyle" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="contentInsetStart">0dp</item>
<item name="contentInsetEnd">0dp</item>
<item tools:ignore="NewApi" name="android:contentInsetStart">0dp</item>
<item tools:ignore="NewApi" name="android:contentInsetEnd">0dp</item>
</style>
:actionBarStyle机器人
and referenced by <item name="android:actionBarStyle"
和 OLD答案 OLD ANSWER 删除微胖添加
您style.xml文件。并引用它从你的应用程序的主题有: to your style.xml file. And reference it from your app theme with:&LT引用
<style name="AppThemeToolbar" parent="Widget.AppCompat.Toolbar">
<item name="contentInsetStart">0dp</item>
<item tools:ignore="NewApi" name="android:contentInsetStart">0dp</item>
</style>
<item name="android:toolbarStyle" tools:ignore="NewApi">@style/AppThemeToolbar</item>
<item name="toolbarStyle">@style/AppThemeToolbar</item>