【发布时间】: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