17

I have defined dialogfragments (because Android documentation says that it is better and indeed it is) but now I want to use it in PreferenceActivity.

The problem is that I cannot use getSupportFragmentManager() there and I cannot use PreferenceFragment since it doesn't work with compatibility library. Looks like a road block scenario.

Can anyone advise on this?

4

1 回答 1

1

正如您所指出的,PreferenceFragment 不在 android 兼容性包中,不幸的是,没有干净的方法可以解决这个问题。对于我自己的个人项目,我不得不改编 Android 源代码的实现:http: //grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.4_r1。 2/android/preference/PreferenceFragment.java

这个问题的答案有一些很好的建议: PreferenceFragment 是否有意从兼容性包中排除?

于 2012-07-25T04:46:35.410 回答