AlertDialog 自定义View

 

 

首先我们定义一个界面

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="10dp">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/title"
        android:scaleType="fitXY"/>
    <EditText
        android:id="@+id/nameET"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="用户名"/>
    <EditText
        android:id="@+id/pwdET"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="密码"/>

</LinearLayout>
custom_dialog.xml

相关文章: