如何更改Android首选项的文字颜色?

ern*_*s7a 0 android text coding-style titlebar preferences

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

getListView().setBackgroundColor(Color.TRANSPARENT);
getListView().setCacheColorHint(Color.TRANSPARENT);
getListView().setBackgroundColor(Color.rgb(255, 255, 255));
Run Code Online (Sandbox Code Playgroud)

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

android:theme="@android:style/Theme.Light"
Run Code Online (Sandbox Code Playgroud)

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

android:theme="@android:style/Theme.NoTitleBar"
Run Code Online (Sandbox Code Playgroud)

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

requestWindowFeature(Window.FEATURE_NO_TITLE);
Run Code Online (Sandbox Code Playgroud)

AndroidRuntimeException: requestFeature() must be called before adding content当尝试打开首选项时,应用程序会崩溃().

小智 5

使用Theme.Light.NoTitleBar :)