![](https://i-blog.csdnimg.cn/blog_migrate/51d7d403f954880f36cb144924a43f3c.jpeg)
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context=".MainActivity"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:gravity="center"
android:layout_gravity="center_horizontal"
>
<ImageView
android:layout_width="150dp"
android:layout_height="200dp"
android:src="@drawable/syr"
android:layout_gravity="center"
android:foregroundGravity="center"
>
</ImageView>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp">
<TextView
android:id="@+id/text_1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="@string/username"
android:textSize="25sp"
android:textColor="#000000"
android:textStyle="bold">
</TextView>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_toEndOf="@id/text_1">
</EditText>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp">
<TextView
android:id="@+id/text_2"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="@string/password"
android:textSize="25sp"
android:textColor="#000000"
android:textStyle="bold">
</TextView>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_toEndOf="@id/text_2"
android:inputType="textPassword">
</EditText>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login">
</Button>
</LinearLayout>
</LinearLayout>
strings.xml
<resources>
<string name="app_name">Login_Demo</string>
<string name="username">账号</string>
<string name="password">密码</string>
<string name="login">登录</string>
</resources>
图片
将图片复制进"drawable",路径如下
"D:\AndroidTools\Login_Demo\app\src\main\res\drawable\syr.jpg"