我正在创建一个 AlertDialog
,该对话框的自定义布局是一个 CardView
(卡片是 xml 布局的根):
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/moreInfoCard"
android:layout_gravity="center"
app:cardCornerRadius="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
//my layout content
</android.support.v7.widget.CardView>
当我显示对话框时,卡片的角是圆的,但角的背景不是透明的。
我该如何解决这个问题?提前谢谢你。
最佳答案
调用 alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transpare nt);
将 AlertDialog
的背景设置为透明,它将起作用
关于android - CardView 角在 AlertDialog 中不圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30371504/