我想要更改我正在开发的应用程序的首选项屏幕的外观。在某些手机上,首选项非常半透明,很难阅读首选项方案,因此我将更改它的视觉效果。
我的问题是如何将主题应用于首选项方案?或者如果失败了,我如何更改显示的各种首选项的文本颜色。
在我当前的版本中,我的首选项布局 xml 文件开头为:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffa0a0a0">
此背景颜色为我提供了可接受的灰色,但我更喜欢使用主题。
我尝试在首选项 xml 和首选项布局 xml 中应用几个不同的主题,但这些都没有显示任何效果。我还尝试为个人首选项和布局设置 andoid:textColor ,但没有效果。
那么如何修改偏好方案的视觉效果(最好使用主题)?
提前致谢,
杰伊
I want the change the look of the preferences screen for an app I am working on. On some phones the preferences are very translucent and it is quite difficult to read the preferences scheme, so I am going to change the visuals for it.
My question is how can I apply a theme to the preferences scheme? Or failing that, how can I change the text color that show up for the various preferences.
In my current version, my preferences layout xml file starts with:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffa0a0a0">
This background color gives me an acceptable gray, but I would prefer to use a theme.
I tried putting a applying a couple of different themes in the preferences xml and the preferences layout xml and none of this has shown any effect. I also tried setting andoid:textColor for the individual preferences items and in layout and that had no effect.
So how does one modify the visuals for the preferences scheme (preferably by using a theme)?
thanks in advance,
Jay
发布评论
评论(1)
基本内容是:
preferenceScreenStyle
、preferenceCategoryStyle
等)themes.xml
)。例如在 styles.xml 中定义Preference.Category
和Preference.PreferenceScreen
样式。如果您想继承默认的 Android 样式,然后覆盖一些其中,然后将 标记中。
parent="@android:style/Theme"
添加到主题的开始有关详细信息,请参阅应用样式和主题。
The basic things are:
preferenceScreenStyle
,preferenceCategoryStyle
etc)themes.xml
). For instance in styles.xml they define thePreference.Category
andPreference.PreferenceScreen
styles.<activity android:theme="@style/CustomTheme"...
If you want to inherit the default Android styles and then just override some of them, then add
parent="@android:style/Theme"
to the opening<style...
tag of your theme.Take a look at Applying Styles and Themes for more info.