对于我的每个 XML 首选项,我都会收到以下警告,
并且我了解 java 认为我给出的默认值是整数,并且它需要字符串。但是如何放置文字字符串?
我可以忍受这个警告,因为我知道它是无害的,但如果有一个简单的方法来纠正它,我会的。
05-16 16:28:03.210: I/ActivityManager(68): Starting activity: Intent { cmp=com.delta.app/.Preferences }
05-16 16:28:03.750: W/Resources(1869): Converting to string: TypedValue{t=0x10/d=0x1388 a=-1}
05-16 16:28:03.870: W/Resources(1869): Converting to string: TypedValue{t=0x10/d=0x64 a=-1}
05-16 16:28:03.901: W/Resources(1869): Converting to string: TypedValue{t=0x10/d=0xa a=-1}
05-16 16:28:03.970: W/Resources(1869): Converting to string: TypedValue{t=0x10/d=0x0 a=-1}
05-16 16:28:03.970: W/Resources(1869): Converting to string: TypedValue{t=0x10/d=0x2 a=-1}
这是 XML:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<EditTextPreference
android:defaultValue="5000"
android:key="@string/MAX_MESSAGES"
android:summary="@string/MAX_MESSAGES_desc"
android:title="@string/MAX_MESSAGES_title" />
<EditTextPreference
android:defaultValue="100"
android:key="@string/VIEW_MAX_ROWS"
android:summary="@string/VIEW_MAX_ROWS_desc"
android:title="@string/VIEW_MAX_ROWS_title" />
<EditTextPreference
android:defaultValue="10"
android:key="@string/VIEW_EDGE_ROWS"
android:summary="@string/VIEW_EDGE_ROWS_desc"
android:title="@string/VIEW_EDGE_ROWS_title" />
<ListPreference
android:defaultValue="0"
android:entries="@array/level_list"
android:entryValues="@array/level_values"
android:key="@string/INITIAL_ORG"
android:summary="@string/INITIAL_ORG_desc"
android:title="@string/INITIAL_ORG_title" />
<ListPreference
android:defaultValue="2"
android:entries="@array/view_list"
android:entryValues="@array/view_values"
android:key="@string/INITIAL_VIEW"
android:summary="@string/INITIAL_VIEW_desc"
android:title="@string/INITIAL_VIEW_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/AUTOSCROLL"
android:summary="@string/AUTOSCROLL_desc"
android:title="@string/AUTOSCROLL_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/SEND_THEN_EXIT"
android:summary="@string/SEND_THEN_EXIT_desc"
android:title="@string/SEND_THEN_EXIT_title" />
<Preference
android:key="@string/DEFAULT_PREFS"
android:summary="@string/DEFAULT_PREFS_desc"
android:title="@string/DEFAULT_PREFS_title" />
</PreferenceScreen>