Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PreferenceFragmentCompat #835

Closed
tcqq opened this issue Apr 11, 2018 · 6 comments
Closed

Support PreferenceFragmentCompat #835

tcqq opened this issue Apr 11, 2018 · 6 comments
Labels

Comments

@tcqq
Copy link

tcqq commented Apr 11, 2018

当前MySupportFragment继承的是Fragment,Fragment如果使用的是PreferenceFragmentCompat怎么办?

@YoKeyword
Copy link
Owner

可以考虑使用 #758

另外下一个版本会加入对 PreferenceFragment 的支持

@tcqq
Copy link
Author

tcqq commented Apr 12, 2018

我尝试在PreferenceFragmentCompat中使用ISupportFragment,但是我发现onAttach(Activity activity)方法已经被弃用。

@YoKeyword
Copy link
Owner

@tcqq 只是标记为过时,并不影响使用的

@tcqq
Copy link
Author

tcqq commented Apr 14, 2018

是的,但是它是一个问题,你能修复一下这个问题吗?

@YoKeyword
Copy link
Owner

onAttach(Activity activity) 库是为了兼容低版本v4包做的处理,同时高版本也可以正常工作,你可以看super.onAttach(activity)的实现; 如果你比较在意,你可以实现onAttach(Context context) 而不实现onAttach(Context activity)

 @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mDelegate.onAttach((Activity)context);
        _mActivity = mDelegate.getActivity();
    }

@tcqq
Copy link
Author

tcqq commented Apr 14, 2018

谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants