BottomSheetDialog获得BottomSheetBehavior的方法
来源:互联网 发布:seo关键词优化 编辑:程序博客网 时间:2024/05/22 15:27
在BottomSheetDialog调用setContentView方法之后,获得BottomSheetBehavior的方法。
( mBottomSheetDialog.setContentView(mContentView); )
第一种:
BottomSheetBehavior mDialogBehavior = BottomSheetBehavior.from((View) mContentView.getParent());
mDialogBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);//展开
第二种:
final FrameLayout frameLayout = (FrameLayout) dialog.findViewById(android.support.design.R.id.design_bottom_sheet);
frameLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
frameLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
BottomSheetBehavior behavior = BottomSheetBehavior.from(frameLayout);
behavior.setPeekHeight(0);//BottomSheetBehavior停留的高度
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);//展开
frameLayout.forceLayout();
}
参考:
http://www.jianshu.com/p/38af0cf77352/comments/1892069
- BottomSheetDialog获得BottomSheetBehavior的方法
- BottomSheetBehavior、BottomSheetDialog和BottomSheetDialogFragment的用法
- Android的Design库---BottomSheetBehavior和BottomSheetDialog
- Material Design系列,Behavior之BottomSheetBehavior与BottomSheetDialog
- Material Design系列,Behavior之BottomSheetBehavior与BottomSheetDialog
- 如何使用Material Design中的BottomSheetBehavior、BottomSheetDialog和BottomSheetDialogFragment
- Android使用BottomSheetBehavior 和 BottomSheetDialog实现底部弹窗
- Android Bottom Sheet详解之BottomSheetBehavior与BottomSheetDialog
- Android BottomSheetDialog消失后再次无法显示的处理方法
- BottomSheetBehavior的坑
- BottomSheetBehavior
- BottomSheetDialog 的两个坑
- BottomSheetDialog的使用
- BottomSheetDialog的简单实用
- 设置 BottomSheetDialog 的高度
- BottomSheetDialog的使用
- BottomSheetDialog
- bottomsheetbehavior和recycleview的冲突
- 最长公共子序列(dp)
- windows 安装MySQL-python-1.2.4b4.win32-py2.7提示which was not found in the registry
- II
- MIDI文件(3)
- sklearn Pipeline使用
- BottomSheetDialog获得BottomSheetBehavior的方法
- 你真的会使用XMLHttpRequest吗?
- Javascript中的__proto__和prototype
- Http请求
- 进行JAR压缩时,参数“cvfm" 和"cvfe"的区别
- mysql 启动报错--发现系统错误2,系统找不到指定的文件。
- JAVA异常
- Java内部类详解
- 实例学习ansible系列(14)playbook变量使用