Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android中创建自定义标题栏_Android_Android Emulator_Android Layout_Android Widget - Fatal编程技术网

在Android中创建自定义标题栏

在Android中创建自定义标题栏,android,android-emulator,android-layout,android-widget,Android,Android Emulator,Android Layout,Android Widget,我为我的应用程序创建了一个自定义标题栏,但在实现它时遇到了一些问题。我想更改文本和标题栏的颜色和外观 styles.xml的布局如下所示: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyTheme"> <item name="android:tabWidgetStyle">@style/LightTabWidget</item> <

我为我的应用程序创建了一个自定义标题栏,但在实现它时遇到了一些问题。我想更改文本和标题栏的颜色和外观

styles.xml的布局如下所示:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="MyTheme">
    <item name="android:tabWidgetStyle">@style/LightTabWidget</item>


</style>
<style name="MyWindowTitleBackground" parent="@android:style/WindowTitleBackground">
    <item name="android:background">@android:drawable/title_bar</item>

</style>

<style name="MyWindowTitle" parent="@android:style/WindowTitle">
    <item name="android:singleLine">true</item>
    <item name="android:windowTitleSize">40dip</item>
    <item name="android:textAppearance">@style/MyTextAppearance</item>
    <item name="android:shadowColor">#BB000000</item>
    <item name="android:shadowRadius">2.75</item>
</style>
 <style name="MyTextAppearance" parent="@android:style/TextAppearance.WindowTitle">
    <item name="android:textColor">#3A6629</item>
    <item name="android:textSize">14sp</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="LightTabWidget" parent="@android:style/Widget.TabWidget">

    <item name="android:textSize">20px</item>
    <item name="android:textStyle">bold</item>

    <item name="android:textColor">#FF5721</item>
</style>
</resources>

@样式/LightTabWidget
@android:可绘制/标题栏
真的
40度
@样式/我的文本外观
#BB000000
2.75
#3A6629
14便士
大胆的
20px
大胆的
#FF5721
我在清单文件中添加了该主题,如下所示:

 <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light">
   <activity android:name="LAFoodBankAboutUs" android:label="@string/app_name" android:theme="@style/MyTheme">

如何显示自定义标题栏?

到现在(几年后),已提供。它具有许多可能性,也可通过

查看和创建自定义窗口标题栏。