当前位置: 首页 > news >正文

江门市网站建设 熊掌号趣味阁小程序入口

江门市网站建设 熊掌号,趣味阁小程序入口,wordpress加qq,编辑wordpress菜单BottomSheetDialog 是Android开发中的一个弹出式对话框,它从屏幕底部弹出并覆盖部分主界面。 1. BottomSheetDialog的使用 // 参数2:设置BottomSheetDialog的主题样式;将背景设置为transparent,这样我们写的shape_bottom_sheet_…

BottomSheetDialog 是Android开发中的一个弹出式对话框,它从屏幕底部弹出并覆盖部分主界面。

1. BottomSheetDialog的使用

// 参数2:设置BottomSheetDialog的主题样式;将背景设置为transparent,这样我们写的shape_bottom_sheet_dialog.xml才会起作用
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.BottomSheetDialog);
//不传第二个参数
//BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);// 底部弹出的布局
View bottomView = LayoutInflater.from(requireContext()).inflate(R.layout.bottom_sheet_layout, null);bottomSheetDialog.setContentView(bottomView);
//设置点击dialog外部不消失
//bottomSheetDialog.setCanceledOnTouchOutside(false);
bottomSheetDialog.show();

2.加载布局

bottom_sheet_layout.xml ; 通过LayoutInflater拿到底部弹窗布局后,通过setContentView()把布局加载到BottomSheetDialog中。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"android:background="@drawable/shape_bottom_sheet_dialog"><TextViewandroid:id="@+id/choose_photo"android:layout_width="match_parent"android:layout_height="50dp"android:text="从手机相册选择"android:textSize="15sp"android:textColor="#191919"android:gravity="center"/><Viewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="#F5F5F5"/><TextViewandroid:id="@+id/check_photo"android:layout_width="match_parent"android:layout_height="50dp"android:text="查看上一张头像"android:textSize="15sp"android:textColor="#191919"android:gravity="center"/><Viewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="#F5F5F5"/><TextViewandroid:id="@+id/save_photo"android:layout_width="match_parent"android:layout_height="50dp"android:text="保存到手机"android:textSize="15sp"android:textColor="#191919"android:gravity="center"/><Viewandroid:layout_width="match_parent"android:layout_height="10dp"android:background="#F5F5F5"/><TextViewandroid:id="@+id/cancel"android:layout_width="match_parent"android:layout_height="50dp"android:text="取消"android:textSize="15sp"android:textColor="#191919"android:gravity="center"/></LinearLayout>

3.显示

通过调用  BottomSheetDialg.show()方法就能将底部弹窗给显示出来。

4. BottomSheetDialog 圆角设置

写一个shape,在Drawable下创建一shape_bottom_sheet_dialog.xml,里面设置圆角的样式。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"><corners android:topLeftRadius="@dimen/dime_10dp"android:topRightRadius="@dimen/dime_10dp"/><solid android:color="@color/white"/></shape>

把bottom_sheet_layout.xml的整个背景设置为shape_bottom_sheet_dialog.xml这个shape。

通过上面的设置,圆角效果并没有展示出来。 还需要将BottomSheetDialog的背景设置为透明。在themes.xml(res->values->themes)添加下面两个style。

    <!--实现BottomSheetDialog圆角效果--><style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"><item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item></style><style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal"><item name="android:background">@android:color/transparent</item></style>

在new BottomSheetDialog()的第二个参数,传入这个style.

new BottomSheetDialog(this, R.style.BottomSheetDialog);

http://www.yayakq.cn/news/630548/

相关文章:

  • 如何自己做个简单网站网站建设服务器是什么意思
  • 中山市做网站公司建网站和建小程序多少钱
  • 温州 网站建设网页视频下载链接
  • 做酒店的网站网站建设的实验总结
  • 网站架构建设网络稿件投稿平台
  • 建立企业网站收费标准直播网站建设需要什么
  • 邯郸企业网站制作建设网站建设项目策划书模板范文
  • 郑州企业建设网站有什么好处自己建设网站网站赚钱
  • 商丘市建立网站公司装修大全
  • 有哪些文本封面做的好的网站wordpress年会员
  • 网站做一些流量互换清洁设备网站模版
  • 免费网站管理软件网站的推广费用票可以做抵扣吗
  • 上海企业网站设计制作网站建设算加工承揽合同吗
  • 做网站 需要 域名 空间门户网站的类型
  • 制作公司网站有哪些好处找人做的网站第二年多钱
  • 专题网站开发工具云羽网络网站建设
  • 肥西县重点工程建设管理局网站阜阳建设工程质量监督网站
  • 企业怎样建网站长沙网站seo技术
  • 请专业公司做个网站要花多少钱国家企业年报网上申报系统
  • 关于建设门户网站的请示wordpress 系统安装教程 pdf
  • 私域流量运营网站seo怎么优化
  • html网站实例wordpress 博客系统
  • 网站域名授权asp.net开发网站和优势
  • 手机qq网页版网站营销案例最新
  • 全屏 网站 代码电脑网站打不开怎么解决
  • 沈阳建设银行网站首页学做网站去哪学
  • 如何做网站费用多少品牌网站设计制作服务公司
  • 网站系统管理员模块给公司做门户网站 可以用凡客吗
  • 网站网站开发违法吗成都本地推广平台
  • 深圳网站建设公司推荐乐云seo做预算查价格的网站是哪个