本文整理汇总了Java中android.support.design.widget.BottomSheetBehavior.getState方法的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetBehavior.getState方法的具体用法?Java BottomSheetBehavior.getState怎么用?Java BottomSheetBehavior.getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.BottomSheetBehavior
的用法示例。
在下文中一共展示了BottomSheetBehavior.getState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleBottomSheet
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private static void toggleBottomSheet(View bottomSheet) {
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
int state = bottomSheetBehavior.getState();
switch (state) {
case BottomSheetBehavior.STATE_COLLAPSED:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
break;
case BottomSheetBehavior.STATE_HIDDEN:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break;
case BottomSheetBehavior.STATE_EXPANDED:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
break;
}
}
示例2: showFragment
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
private void showFragment() {
if (mInsideBottomSheet != null) {
BottomSheetBehavior behavior = BottomSheetBehavior.from(mInsideBottomSheet);
if (behavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
}
}
示例3: onBackPressed
import android.support.design.widget.BottomSheetBehavior; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
BottomSheetBehavior b = BottomSheetBehavior.from(mPanel);
if (b.getState() != BottomSheetBehavior.STATE_HIDDEN) {
b.setState(BottomSheetBehavior.STATE_HIDDEN);
return;
}
super.onBackPressed();
}