activity-main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/ic_launcher" tools:context=".MainActivity"> <ImageView android:id="@+id/iv_head" android:layout_width="50dp" android:layout_height="50dp" android:layout_centerHorizontal="true" android:layout_marginTop="100dp" android:src="@drawable/ic_launcher"/> <LinearLayout android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/iv_head" android:layout_margin="10dp" android:orientation="vertical"> <RelativeLayout android:id="@+id/regist_username" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp"> <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="用户名:" android:textSize="20sp" /> <EditText android:id="@+id/et_name" android:layout_