我想知道如何为我的 PreferenceFragment
中的标题设置颜色它使用新的 AppCompat
主题。我的设置截图Fragment
,这extends
PreferenceFragment
, 如下图所示:
我可以设置 ActionBar
的颜色通过使用 colorPrimary
属性,以及主要和次要文本的颜色,使用 android:textColor
和 android:textColorSecondary
属性,分别。但是,我不知道如何设置标题的颜色 - 任何帮助将不胜感激。
最佳答案
我正在使用这个(你也可以删除 .Inverse):
android:textAppearance="@style/TextAppearance.AppCompat.Subhead.Inverse"
在我的标题中我使用了 colorAccent,然后:
android:textColor="?attr/colorAccent"
我所有的 TextView:
<TextView
android:id="@+id/textViewAdvancedSetting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical"
android:text="Advanced Settings"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead.Inverse"
android:textColor="?attr/colorAccent"
android:textSize="14sp" />
它的图像(jellybean、kitkat 和 lollipop),黑色边框是模拟器:
关于android - 在 AppCompat 主题中设置标题颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28160452/