getView() из BottomSheetFragment
Я реализую приложение с BottomSheetFragment
и не могу понять, где я могу получить доступ к измеренному корню View
фрагмента. Проблема в том, что onViewCreated()
не вызывается. А также getView()
в onAttach()
, onActivityCreated()
, onStart()
, onResume()
вернуть ноль. Мой код setupDialog
метод:
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
View contentView = View.inflate(getContext(), getContentResource(), null);
dialog.setContentView(contentView);
}
1 ответ
Вы можете это получить от onCreateView
фрагмента
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.your_custom_bottom_sheet_layout, container, false);
//Your code here
return rootView;
}