Java Android Studio BottomSheetFragment.show错误
我试图在有地图的活动中使用底部工作表。然而Java Android Studio BottomSheetFragment.show错误,java,android,Java,Android,我试图在有地图的活动中使用底部工作表。然而 public void showBottomSheetDialogFragment() { BottomSheetDetailsFragment bottomSheetFragment = new BottomSheetDetailsFragment(); //This line shows an error in android studio bottomSheetFragment.show(getSupportFra
public void showBottomSheetDialogFragment() {
BottomSheetDetailsFragment bottomSheetFragment = new BottomSheetDetailsFragment();
//This line shows an error in android studio
bottomSheetFragment.show(getSupportFragmentManager(), "TAG");
}
还有我的床底碎片
public class BottomSheetDetailsFragment extends Fragment {
public BottomSheetDetailsFragment() {
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_bottom_sheet_details, container, false);
}
}
我哪里做错了?请显示LogCatBuild中打印的错误,错误为:找不到符号bottomSheetFragment.show(getSupportFragmentManager(),“TAG”);^symbol:method show(FragmentManager,String)location:bottomsheetdetails Fragment类型的变量bottomSheetFragment Fragment对不起,为什么要从
Fragment
扩展,需要从BottomSheetDialogFragment
Wow谢谢。这就解决了:)