【发布时间】:2014-01-15 11:13:24
【问题描述】:
我已经为 API 级别“7-13”和“14 及以上”提供了一个自定义主题,不同的 style.xml
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="actionBarStyle">@style/CustomTheme</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="background">@color/medium_turquoise</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarSize">200dp</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="homeAsUpIndicator">@drawable/back_button_actionbar</item>
我已将应用程序的主题设置为“@style/CustomTheme”,并在我的活动中设置了以下主题。
addView = getLayoutInflater().inflate(R.layout.actionbar, null);
getSupportActionBar().setCustomView(addView);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
整个屏幕都被action bar占据了,我尝试改变高度但是没有用。我想我在风格上犯了一些错误。
谢谢
【问题讨论】:
标签: android android-actionbar android-actionbar-compat