一、添加图片
<ImageView android:id="@+id/iv" android:layout_width="70dp" android:layout_height="70dp" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:background="@drawable/logo" //在drawable文件夹下添加图片logo.jgp
二、添加文本框
<LinearLayout android:id="@+id/ll_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/iv" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:layout_marginBottom="5dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="@drawable/tran1" //在drawable文件夹下添加文本tran1.xml也可以改为android:background=“#ffffff” > <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:text="用户名:" android:textColor="#000" android:textSize="20sp" /> <EditText android:id="@+id/et_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入用户名" android:layout_marginLeft="5dp" android:background="@drawable/tran" //在drawable文件夹下添加文本tran.xml也可以改为android:background=“#ffffff” android:padding="10dp" /> </LinearLayout>
密码文本框的设计与上面基本相同
三、添加按键
<Button android:id="@+id/bth_1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll_mima" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:background="@drawable/tran2" //在drawable文件夹下添加文本tran2.xml也可以改为android:background=“#0044ff” android:text="登录" android:textSize="20sp" android:textColor="#ffffff" />