android 如何删除白色角

uujelgoq  于 2023-02-10  发布在  Android
关注(0)|答案(3)|浏览(125)

添加后轮后如何去除白色的边角?
编辑:这是一个弹出对话框
它看起来像这样:

代码如下:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/color_choose_dialog"

//下面是后台的代码:

`<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">
 <solid 
 android:color="@color/md_theme_light_onPrimary" />
 <corners
    android:radius="30dp" />
 <padding
    android:left="20dp"
    android:top="20dp"
    android:right="20dp"
    android:bottom="20dp" />
 </shape>

谢谢你的帮助!!!

jdg4fx2g

jdg4fx2g1#

AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
    ....

    AlertDialog alertDialog = builder.create();
    
    //remove white space
    alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    alertDialog.show();
zf9nrax1

zf9nrax12#

我认为您需要使用卡片,而不是使用ConstraintLayout,并使用
app:cardCornerRadius="20dp"
我想这会解决你的问题

snz8szmq

snz8szmq3#

尝试将背景颜色从白色更改为透明。角的白色将不可见。

相关问题