作業1:安裝環境,截圖程式設計界面,截圖運作界面
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsISPrdEZwZ1Rh5WNXp1bwNjW1ZUba9VZwlHdsATOfd3bkFGazxCMx8VesATMfhHLlN3XnxCMwEzX0xiRGZkRGZ0Xy9GbvNGLpZTY1EmMZVDUSFTU4VFRR9Fd4VGdsYTMfVmepNHLrJXYtJXZ0F2dvwVZnFWbp1zczV2YvJHctM3cv1Ce-cmbw5iYygDZiVTNxQTMxcjMwIGNzQTM2gTN3QDOzYWMjZzMh9CX4AzLcBTMxIDMy8CXn9Gbi9CXzV2Zh1WavwVbvNmLvR3YxUjL4M3Lc9CX6MHc0RHaiojIsJye.png)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="1dp">
<View
android:id="@+id/v_1"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#F44336"
android:layout_centerInParent="true"/>
<View
android:id="@+id/v_2"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#9C27B0"
android:layout_centerInParent="true"
android:layout_toLeftOf="@id/v_1"/>
<View
android:id="@+id/v_3"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#3F51B5"
android:layout_centerInParent="true"
android:layout_toRightOf="@id/v_1"/>
<View
android:id="@+id/v_4"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#2196F3"
android:layout_centerInParent="true"
android:layout_above="@id/v_1"/>
<View
android:id="@+id/v_5"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#00BCD4"
android:layout_centerInParent="true"
android:layout_above="@id/v_1"
android:layout_toLeftOf="@id/v_4"/>
<View
android:id="@+id/v_6"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#8BC34A"
android:layout_centerInParent="true"
android:layout_above="@id/v_1"
android:layout_toRightOf="@id/v_4"/>
<View
android:id="@+id/v_7"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#26E984"
android:layout_centerInParent="true"
android:layout_below="@id/v_1"/>
<View
android:id="@+id/v_8"
android:layout_width="85dp"
android:layout_height="85dp"
android:background="#FF9800"
android:layout_centerInParent="true"
android:layout_below="@id/v_1"
android:layout_toLeftOf="@id/v_7"/>
<View
android:id="@+id/v_9"
android:layout_width="70dp"
android:layout_height="70dp"
android:background="#FFEB3B"
android:layout_centerInParent="true"
android:layout_below="@id/v_1"
android:layout_toRightOf="@id/v_7"/>
</RelativeLayout>
作業3:布局界面(QQ群截圖)
?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:padding="20dp"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<View
android:id="@+id/v_1"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_weight="1"
android:background="#E91E63"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:background="@color/purple_700"
android:layout_weight="2">
<View
android:id="@+id/v_2"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/purple_200"/>
<View
android:id="@+id/v_3"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/teal_200"/>
<View
android:id="@+id/v_4"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FF5722"/>
</LinearLayout>
<View
android:id="@+id/v_5"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_weight="1"
android:background="#FFEB3B"/>
</LinearLayout>
作業3:制作登入界面
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:id="@+id/tv_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用者"
android:textSize="24sp"
android:textColor="#000000"
android:layout_margin="10dp"
android:layout_centerVertical="true"
android:padding="10dp"/>
<TextView
android:id="@+id/tv_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密碼"
android:textSize="24sp"
android:textColor="#000000"
android:layout_margin="10dp"
android:layout_centerVertical="true"
android:padding="10dp"
android:layout_below="@id/tv_1"/>
<EditText
android:id="@+id/et_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:hint="請輸入賬号"
android:textColor="#000000"
android:textSize="24sp"
android:layout_margin="10dp"
android:padding="10dp"
android:layout_toRightOf="@id/tv_1"
android:drawablePadding="10dp"/>
<EditText
android:id="@+id/et_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_1"
android:layout_centerVertical="true"
android:hint="請輸入密碼"
android:textColor="#000000"
android:textSize="24sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="10dp"
android:layout_toRightOf="@id/tv_1"
android:drawablePadding="10dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/et_2"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:padding="10dp"
android:background="#03A9F4"
android:text="登入"
android:textSize="24sp"/>
</RelativeLayout>