一、新建.xml文件
-
在res中新建resourcefile
-
代码:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#80ffffff"/>
<stroke android:width="1dp" android:color="#000000"/>
<corners android:radius="18dp"/>
</shape>
</item>
</layer-list>
二、编辑activity_main.xml文件
- 代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background1"/>
<EditText
android:layout_width="150dp"
android:layout_height="50dp"
android:background="@drawable/edit_style"
android:gravity="center"
android:hint="用户账号"
android:textColor="#000000"
android:textSize="25sp"
android:layout_gravity="bottom"
android:layout_marginLeft="45dp"
android:layout_marginBottom="75dp"/>
<ImageView
android:id="@+id/iv_play"
android:layout_width="115dp"
android:layout_height="102dp"
android:layout_gravity="bottom|right"
android:layout_marginRight="50dp"
android:layout_marginBottom="50dp"
android:src="@drawable/user" />
</FrameLayout>
</LinearLayout>
- 在drawable文件中添加的背景图片为background1与user。