0
我有底部表單對話框,當按鈕被點擊時顯示,所以我已經實現了底部表單對話框的所有邏輯到onClick方法的按鈕,我怎樣才能使單獨的類顯示底部表單對話框,只需調用方法的onClickAndroid:如何使BottomSheetDialog的分離類
這是我在的onClick代碼:
BottomSheetDialog mBottomSheetDialog = new BottomSheetDialog(this);
View sheetView = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
NumberPicker minutePicker = (NumberPicker) sheetView.findViewById(R.id.np);
tv = (TextView) sheetView.findViewById(R.id.tv);
minutePicker.setMaxValue(100);
minutePicker.setMinValue(0);
minutePicker.setWrapSelectorWheel(false);
mBottomSheetDialog.setContentView(sheetView);
mBottomSheetDialog.show();
minutePicker.setOnValueChangedListener(
new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldVal,
int newVal) {
tv.setText(Integer.toString(newVal));
}
});
}