本文整理匯總了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();
}