[英]How to lock bottom sheet to his peek height?
I am using this library: 我正在使用这个库:
compile 'com.android.support:design:23.2.0'
And i did this bottom sheet but after some actions i want to lock it on the bottom of the screen only with 1 raw visible. 我做了这个底页,但经过一些动作,我想把它锁定在屏幕的底部,只有1个原始可见。 This is the tutorial where I am looking from. 这是我正在寻找的教程。 I want to lock the bottom sheet like the 3rd item from the tutorial. 我想像教程中的第3项一样锁定底部工作表。
If you have any ideas will be great :) 如果你有什么想法会很棒:)
Here is my code: 这是我的代码:
private void initBottomSheet() {
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setPeekHeight(200);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(View bottomSheet, int newState) {
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
mBottomSheetBehavior.setPeekHeight(200);
}
}
@Override
public void onSlide(View bottomSheet, float slideOffset) {
}
});
}
我认为您忘记使用此代码: mBottomSheetBehavior.setPeekHeight(300);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.