Android 如何让Dialog实现背景透明
16lz
2021-01-23
View inflate = LayoutInflater.from(context).inflate(R.layout.qrcode, null);ImageView qrcode = (ImageView) inflate.findViewById(R.id.iv_qrcode);ImageView guanbi = (ImageView) inflate.findViewById(R.id.iv_guanbi);final Dialog dialog = new AlertDialog .Builder(context) .setView(inflate) .show();dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);Glide.with(context).load(list.get(position).getDwhat()).into(qrcode);Animation animation = AnimationUtils.loadAnimation(context, R.anim.scale);inflate.setAnimation(animation);animation.start();最关键的一行代码 布局文件
<?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="match_parent" android:orientation="vertical"> <ImageView android:id="@+id/iv_qrcode" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <View android:layout_width="match_parent" android:layout_height="80dp" android:background="#00000000" /> <ImageView android:id="@+id/iv_guanbi" android:layout_width="40dp" android:layout_height="40dp" android:background="@android:color/transparent" android:layout_gravity="center" android:src="@drawable/guanbi" />LinearLayout>
更多相关文章
- android 6.0权限问题处理的核心代码--shouldShowRequestPermissi
- Android 添加新的联系人代码
- 解决TabLayout+viewpager 滑动切换时 布局文件不是从头显示
- Android 图片透明度处理代码
- android截图代码
- android1.5---2.1实现js调摄像头,调Java代码
- 【Android代码片段之三】TabActivity实现多页显示效果
- Android 项目代码混淆