【问题标题】:How to change text color of Android's preferences?如何更改Android首选项的文本颜色?
【发布时间】:2010-11-29 17:33:26
【问题描述】:

我想将我的 Android 应用首选项屏幕的外观更改为白色背景和深色文本颜色。看来我可以在代码中更改背景颜色。有没有类似的方法可以在代码中更改首选项的文本颜色?

getListView().setBackgroundColor(Color.TRANSPARENT);
getListView().setCacheColorHint(Color.TRANSPARENT);
getListView().setBackgroundColor(Color.rgb(255, 255, 255));

另一种方法是在应用的清单中设置活动的主题:

android:theme="@android:style/Theme.Light"

但是,这会覆盖应用程序的样式,当前设置为

android:theme="@android:style/Theme.NoTitleBar"

因此,标题栏显示在首选项屏幕中。我可以尝试删除栏

requestWindowFeature(Window.FEATURE_NO_TITLE);

然后,当尝试打开首选项时,该应用会崩溃 (AndroidRuntimeException: requestFeature() must be called before adding content)。

【问题讨论】:

    标签: android text coding-style preferences titlebar


    【解决方案1】:

    使用 Theme.Light.NoTitleBar :)

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-31
    • 2012-08-08
    • 2021-04-29
    • 1970-01-01
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多