Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android将图标添加到自定义警报对话框的边缘_Android_Xml_Layout_Android Alertdialog - Fatal编程技术网

android将图标添加到自定义警报对话框的边缘

android将图标添加到自定义警报对话框的边缘,android,xml,layout,android-alertdialog,Android,Xml,Layout,Android Alertdialog,我想在自定义警报对话框中添加一个图标 我希望它被添加到对话框的边缘,如下图所示 那么我如何才能做到这一点呢 您应该使用圆形图像视图 实现//圆形图像 实现“com.makeramen:roundeImage视图:2.3.0” 2.添加此代码 <?xml version="1.0" encoding="utf-8"?> 我将在replay中添加步骤3。对于可拉伸折叠的深蓝色圆圈.xml//////////////////////

我想在自定义警报对话框中添加一个图标

我希望它被添加到对话框的边缘,如下图所示

那么我如何才能做到这一点呢


您应该使用圆形图像视图

  • 实现//圆形图像 实现“com.makeramen:roundeImage视图:2.3.0”
  • 2.添加此代码

    <?xml version="1.0" encoding="utf-8"?>
    
    
    

    
    


    我将在replay中添加步骤3。对于可拉伸折叠的深蓝色圆圈.xml////////////////////////////////////////////////////////////////////////
    <?xml version="1.0" encoding="utf-8"?>
    
        <com.makeramen.roundedimageview.RoundedImageView
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_marginTop="10dp"
            android:elevation="2dp"
            android:background="@drawable/grey_circle"
            android:layout_centerHorizontal="true"/>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:background="@drawable/rounded_white_rectangle"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_marginTop="80dp">
            <TextView
                android:layout_marginTop="30dp"
                android:textColor="@color/blue_dark"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Warning"
                android:textStyle="bold"
                android:textAlignment="center"
                android:textSize="40dp"/>
    
            <TextView
                android:layout_marginTop="30dp"
                android:textColor="@color/blue_dark"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="You just display this"
                android:textAlignment="center"
                android:textSize="40dp"/>
            
            <Button
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:text="Done"
                android:layout_marginStart="30dp"
                android:layout_marginEnd="30dp"
                android:textSize="40dp"
                android:textColor="white"/>
    
        </LinearLayout>
    
    </RelativeLayout>