从RecyclerView.ViewHolder扩展类中显示DialogFragment

时间:2017-12-19 16:11:56

标签: java android android-recyclerview

我遇到与此问题有关的问题Starting DialogFragment from a class extending RecyclerView.ViewHolder

我已经尝试了解决方案,我遇到了getSupportFragmentManager()方法的错误。

    Error:(147, 15) error: no suitable method found for 
    show(android.support.v4.app.FragmentManager,String)
    method DialogFragment.show(android.app.FragmentManager,String) is not applicable
   (argument mismatch; android.support.v4.app.FragmentManager cannot be converted to android.app.FragmentManager)
    method DialogFragment.show(FragmentTransaction,String) is not applicable
   (argument mismatch; android.support.v4.app.FragmentManager cannot be converted to FragmentTransaction)

1 个答案:

答案 0 :(得分:0)

您需要从android.support.v4.app.DialogFragment扩展对话框片段类,而不是从android.app.DialogFragment

扩展