1、首先我们先看一下效果图
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" > <RelativeLayout android:id="@+id/login_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:gravity="center" > <FrameLayout android:id="@+id/username_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="55dp" android:gravity="center" > <EditText android:id="@+id/username_edit" android:layout_width="match_parent" android:layout_height="55dp" android:layout_marginTop="5dp" android:hint="账号/手机号/邮箱" android:paddingRight="60dp" android:maxLength="20" android:paddingLeft="55dp" > </EditText> <ImageView android:layout_width="22dp" android:layout_height="21dp" android:layout_marginStart="8dp" android:layout_gravity="left|center_vertical" android:background="@drawable/zhanghao" android:visibility="visible" /> <TextView android:id="@+id/contry_sn" android:layout_width="40dp" android:layout_height="50dp" android:layout_gravity="left|center_vertical" android:layout_marginTop="4dp" android:gravity="center" android:text="+62" android:textColor="@android:color/black" android:textSize="18sp" android:visibility="invisible" /> </FrameLayout> <FrameLayout android:id="@+id/usercode_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/username_layout" android:layout_marginTop="6dp" android:gravity="center" > <EditText android:id="@+id/userpassword_edit" android:layout_width="match_parent" android:layout_height="55dp" android:hint="密码" android:inputType="textPassword" android:paddingRight="60dp" android:maxLength="20" android:paddingLeft="55dp" > </EditText> <ImageView android:layout_width="24dp" android:layout_height="22dp" android:layout_marginStart="7dp" android:layout_gravity="left|center_vertical" android:background="@drawable/mima" /> <Button android:id="@+id/passwordeye" android:layout_width="23dp" android:layout_height="23dp" android:background="@drawable/kejian" android:layout_gravity="right|center_vertical" android:layout_marginRight="10dp" /> </FrameLayout> <Button android:id="@+id/login_button" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_below="@+id/usercode_layout" android:layout_centerHorizontal="true" android:layout_marginTop="34dp" android:background="@drawable/bluebutton" android:textSize="18sp" android:text="登 录" android:textColor="#ffffff" /> <Button android:id="@+id/login_error" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@id/login_button" android:layout_below="@id/login_button" android:text="忘记密码" android:background="#00000000" android:textSize="16sp" /> <Button android:id="@+id/register" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/login_button" android:layout_below="@id/login_button" android:background="#00000000" android:gravity="left|center_vertical" android:text="注册" android:textSize="16sp" android:visibility="visible" /> </RelativeLayout> <RelativeLayout android:id="@+id/remember_layout000" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="1dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" > <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textSize="19dp" android:textColor="@color/colorPrimary" android:layout_marginLeft="90dp" android:text="-----第三方登录-----" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="75dp" android:orientation="horizontal" > <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <Button android:id="@+id/qq" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:drawableTop="@drawable/qq" /> </LinearLayout> <LinearLayout android:id="@+id/weibo" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center"> <Button android:id="@+id/gonggao_button" android:layout_width="match_parent" android:layout_height="match_parent" android:drawableTop="@drawable/weibo" android:background="#00000000" /> </LinearLayout> <LinearLayout android:id="@+id/dongtai" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center"> <Button android:id="@+id/weixin" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:drawableTop="@drawable/weixin" /> </LinearLayout> </LinearLayout> </LinearLayout> </RelativeLayout> </RelativeLayout>