我正在尝试阅读我的应用偏好设置,但出现此错误:
设置活动:
public class Settings extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
try
{
addPreferencesFromResource(R.xml.prefs);
}
catch (Exception ex)
{
Log.e("errorSettings", Log.getStackTraceString(ex));
}
}
}
首选项 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="General">
<SwitchPreference
android:title="Downloader"
android:defaultValue="true"
android:key="useDownloader"
android:summary="Enable to use" />
</PreferenceCategory>
</PreferenceScreen>
在应用程序清单上我设置了这个:
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="15" />
我得到的第一个错误是:
android.view.InflateException: Binary XML file line #4: Error inflating class SwitchPreference
预先感谢。