Can't get the PreferenceFragment to work (Compiling error)

这一生的挚爱 提交于 2019-12-05 08:50:25
ianhanniballake

That's because PreferenceFragment extends android.app.Fragment, rather than the android.support.v4.app.Fragment that the android.support.v4.app.FragmentTransaction is expecting.

As of yet, there is no official backport of the PreferenceFragment to the support library. However, you can use libraries such as UnifiedPreferences to fill this gap.

Check the import statements at the top of your code. Likely one of the classes you are using is from support while the other is not.

Here is the unofficial backport of the PreferenceFragment to the support library. Last update was Feb 2015 & it's compatible with lollipop devices. android-support-v4-preferencefragment

import android.support.v4.preference.PreferenceFragment;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!