android Dialog 底部弹出
16lz
2021-01-23
、
if (dialShareDialog == null) {dialShareDialog = new Dialog(context, R.style.dialog);dialShareDialog.setContentView(R.layout.dialog_share);dialShareDialog.setCanceledOnTouchOutside(true);// 获取对话框的窗口,并设置窗口参数WindowManager.LayoutParams lp=dialShareDialog.getWindow().getAttributes();lp.dimAmount=0.7f;dialShareDialog.getWindow().getDecorView().setPadding(0, 0, 0, 0); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT;dialShareDialog.getWindow().setGravity(Gravity.BOTTOM);}ImageView weixinIv = (ImageView) dialShareDialog.findViewById(R.id.share_weixin_iv);ImageView friendIv = (ImageView) dialShareDialog.findViewById(R.id.share_friend_iv);ImageView kongjianIv = (ImageView) dialShareDialog.findViewById(R.id.share_kongjian_iv);ImageView sinaIv = (ImageView) dialShareDialog.findViewById(R.id.share_sina_iv);weixinIv.setOnClickListener(shareOnClickListener);friendIv.setOnClickListener(shareOnClickListener);kongjianIv.setOnClickListener(shareOnClickListener);sinaIv.setOnClickListener(shareOnClickListener);dialShareDialog.show();
xml 文件
<?xml version="1.0" encoding="utf-8"?>
自定义弹出层样式
更多相关文章
- 两种进度条对话框
- android Fragment添加Theme,使背景模糊
- 天天记录 - Android创建应用窗口分析2
- 【起航计划 016】2015 起航计划 Android APIDemo的魔鬼步伐 15 A
- Android 应用软件开发(六)窗口布局