主题标题栏不显示渐变

时间:2014-04-26 05:44:22

标签: android android-theme

我想为我的应用创建一个主题,如下所示:

enter image description here

为此,我在styles.xml文件

中输入了此内容
<style name="TestAppThemeTopbar">
    <item name="android:background">@drawable/gradient_topbar</item>
    <item name="android:text">@string/topbar_title</item>
    <item name="android:gravity">center</item>
    <item name="android:textColor">#6D929B</item>
</style>
<style name="TestAppTheme" parent="android:Theme">
    <item name="android:background">#F5FAFA</item>
    <item name="android:windowTitleSize">81dip</item>
    <item name="android:windowTitleBackgroundStyle">@style/TestAppThemeTopbar</item>
</style>

gradient_topbar是一个xml文件,其中包含以下内容:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
    <!--  Gradient Bg for listrow -->
   <gradientTopbar
      android:layout_width="match_parent"
      android:layout_height="81dip"
      android:layout_weight="1"
      android:startColor="#B7AFA3"
      android:endColor="#E8D0A9"
      android:angle="270" />
</shape>

我将主题添加到清单文件中。并将主题应用于项目。现在在Graphical Layout的{​​{1}}中,主题的外观如下:

enter image description here

  1. 标题栏渐变未显示
  2. 文字不在中心
  3. 文字为白色背景
  4. 我还需要做以下事情:

    1. 需要增加文字大小
    2. 文字的自定义字体
    3. 文字的字体颜色
    4. 我做错了导致前三个问题?怎么解决?如何做到第二个?

      修改

      这就是我将主题添加到清单文件的方式:

      fragment_main.xml

0 个答案:

没有答案