安卓:自定义标题栏 [英] Android: Custom Title Bar
问题描述
我有一个自定义标题栏
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activities);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
其中一期工程基本正常。问题是,直到上述code被称为默认的标题栏显示。我不想要一个标题栏存在一样,换句话说,之前我的显示了没有标题应显示出来。
Which works basically fine. The problem is that until the above code is called the default title bar is shown. I don't want a title bar there at all, in other words before mine shows up no title shall show up.
添加此到清单:
<application android:theme="@android:style/Theme.NoTitleBar">
导致强制关闭。我的清单看起来像这样
leads to a force close. My manifest looks like this
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@style/My_Theme">
我需要my_Theme因为它提出的背景颜色,设置背景颜色在我的客户的主题导致在我色底色的灰色地带。所以,即使没有强制关闭,我不知道,如果没有标题会有所帮助。
Where I need my_Theme since it sets the background color, setting the background color in my customer theme leads to a gray area around my colored backround. So even without the force close I am not sure if the no title will help.
你知道吗?
感谢。
推荐答案
我有同样的问题,因为你。
I had the same issue as you.
这个问题是什么,你有你的风格。
The issue is with something you have in your style.
尝试了这一点:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="My_Theme">
<item name="android:windowTitleSize">35dp</item>
<item name="android:windowTitleBackgroundStyle">@android:color/black</item>
</style>
</resources>
这篇关于安卓:自定义标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!