BottomSheetDialogFragment 的使用
2017-08-03 11:16
357 查看
参考文档
https://material.io/guidelines/components/bottom-sheets.html自定义类:XBottomSheetDialogFragment
public class XBottomSheetDialogFragment extends BottomSheetDialogFragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View inflate = inflater.inflate(R.layout.view_bottom_sheet_fragment, container); return inflate; } }
自定义布局文件 view_bottom_sheet_fragment
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/default_app_main_color"> <RelativeLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="300px"> <TextView android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="啦啦啦啦啦"/> </RelativeLayout> </LinearLayout>
代码中控制显示隐藏
private XBottomSheetDialogFragment mXBottomSheetDialogFragment; @OnClick(R.id.btn_dialog_fragment) public void dialog(){ if(mXBottomSheetDialogFragment == null){ mXBottomSheetDialogFragment = new XBottomSheetDialogFragment(); } mXBottomSheetDialogFragment.show(getSupportFragmentManager(),"Dialog"); }
相关文章推荐
- 使用 DialogFragment 和 BottomSheet 实现底部弹出框
- 如何使用Material Design中的BottomSheetBehavior、BottomSheetDialog和BottomSheetDialogFragment
- 如何禁止使用bottomsheetdialogfragment拖动?
- Bottom Sheet的使用和BottomSheetDialogFragment的封装
- 如何禁止使用bottomsheetdialogfragment拖动?
- 解决使用BottomSheetDialog时状态栏变黑的问题
- Support Design库中的BottomSheetDialog组件使用
- Android 分享界面,使用BottomSheetDialog(可上拉到顶部,可下拉消失,仿知乎、掘金等)
- BottomSheetDialog的使用及注意事项
- 解决使用BottomSheetDialog时状态栏变黑的问题
- Android使用BottomSheetBehavior 和 BottomSheetDialog实现底部弹窗
- BottomSheetBehavior、BottomSheetDialog和BottomSheetDialogFragment的用法
- BottomSheetDialog的使用
- Android 6.0新控件 BottomSheetDialog | 底部对话框 介绍及使用详情
- BottomSheetDialog的使用
- 解决使用BottomSheetDialog时状态栏变黑的问题
- 解决使用BottomSheetDialog时状态栏变黑的问题
- android 之 Fragment 中使用 DialogFragment 创建回调
- Android官方推荐使用DialogFragment替换AlertDialog
- Android开发——官方推荐使用DialogFragment替换AlertDialog