下面列出了怎么用android.support.design.widget.BottomSheetDialogFragment的API类实例代码及写法,或者点击链接到github查看源代码。
public void add(int pos) {
final ContentFragment ma = mainActivity.slideFrag1Selected ? mainActivity.curContentFrag : mainActivity.curExplorerFrag;//(MainFragment) ((TabFragment) mainActivity.getSupportFragmentManager().findFragmentById(R.id.content_frame)).getCurrentTabFragment();
final String path = ma.currentPathTitle;
switch (pos) {
case NEW_FOLDER:
mkdir(ma.openMode, path, ma);
break;
case NEW_FILE:
mkfile(ma.openMode, path, ma);
break;
case NEW_CLOUD:
BottomSheetDialogFragment fragment = new CloudSheetFragment();
fragment.show(ma.getActivity().getSupportFragmentManager(),
CloudSheetFragment.TAG_FRAGMENT);
break;
}
}
@Override
public void onClick(View v) {
switch( v.getId() ) {
case R.id.button_1: {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
break;
}
case R.id.button_2: {
mBottomSheetBehavior.setPeekHeight(300);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
}
case R.id.button_3: {
BottomSheetDialogFragment bottomSheetDialogFragment = new TutsPlusBottomSheetDialogFragment();
bottomSheetDialogFragment.show(getSupportFragmentManager(), bottomSheetDialogFragment.getTag());
break;
}
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(BottomSheetDialogFragment.STYLE_NO_FRAME, R.style.Theme_Design_BottomSheetDialog);
}