类膨胀错误<unknown> [Android]

时间:2015-08-29 21:21:01

标签: java android xml preferences

我正在尝试在我的应用中实现首选项片段,但是当我在应用中打开片段时,我收到了一个奇怪的错误。

  FATAL EXCEPTION: main
Process: com.stairsapps.elohel, PID: 9611
android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
        at android.view.LayoutInflater.createView(LayoutInflater.java:633)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:164)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:148)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
        at android.preference.Preference.onCreateView(Preference.java:510)
        at android.preference.Preference.getView(Preference.java:487)
        at android.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:246)
        ...

SettingsFragment.java

public class SettingsFragment extends PreferenceFragment {


public SettingsFragment() {
    // Required empty public constructor
}


@Override
public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    addPreferencesFromResource(R.xml.preferences);
}

的preferences.xml

<?xml version="1.0" encoding="utf-8"?><PreferenceScreen  xmlns:android="http://schemas.android.com/apk/res/android">

<CheckBoxPreference
    android:title="Layout"
    android:summary="Display the jokes in a list"
    android:key="layout_mode"
    android:defaultValue="true"
    ></CheckBoxPreference></PreferenceScreen>

0 个答案:

没有答案