问题
me again, working on some android live-wallpaper, again,
I have a small weird problem. I create a first level of for my settings, everything is OKAY. But at some point, I needed some sub level and create a new as an item of the first one like in the following example:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/wallpaper_settings"
android:key="wallpaper_settings">
<PreferenceScreen android:title="Gray or Color">
<CheckBoxPreference
android:key="gray_color"
android:summary="Gray"
android:title="Use color ?"
android:summaryOn="Color"
android:summaryOff="Gray"
android:persistent="true"/>
</PreferenceScreen>
</PreferenceScreen>
But the thing is, the title for the CheckBoxPreference doesn't appear, actually, it only appears when I press on it. And I have the same problem with other items too. What should I do ?
Thanks!
EDIT: Okay, now I see the problem, it's that the text is in black... Is there a way to change the color of the text of the force the backcolor of the preference screen ? like white or not black ?
EDIT 2: I solved the problem. I copy/paste some stuff from the manifest of CubeLiveWallpaper (the demo available with the SDK) and I shouldn't have kept the Theme, that was Theme.Light.WallpaperSettings. By removing it, I removed these problems.
Thanks for the help!
回答1:
Since preferences is just a special type of Activity, you have to add it in the Android manifest and add a title (label) there:
<activity
android:name="Preferences"
android:label="Gray or Color">
</activity>
来源:https://stackoverflow.com/questions/6714942/problem-with-titles-in-preferencescreen-android