andorid第一次作业
作业1
作业2
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/v_1" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:id="@+id/v_2" android:layout_height="63dp" android:background="#000000" android:layout_width="62dp" android:layout_centerInParent="true"/> <RelativeLayout android:id="@+id/v_3" android:layout_height="63dp" android:background="#87CEEB" android:layout_width="62dp" android:layout_below="@id/v_2"/> <RelativeLayout android:id="@+id/v_4" android:layout_height="63dp" android:background="#00FF00" android:layout_width="62dp" android:layout_above="@id/v_2"/> <RelativeLayout android:id="@+id/v_5" android:layout_height="63dp" android:background="#FF0000" android:layout_width="62dp" android:layout_toRightOf="@id/v_2"/> <RelativeLayout android:id="@+id/v_6" android:layout_height="61dp" android:background="#0000FF" android:layout_width="62dp" android:layout_toRightOf="@id/v_3"/> <RelativeLayout android:id="@+id/v_7" android:layout_height="63dp" android:background="#FFC0CB" android:layout_width="62dp" android:layout_below="@id/v_6"/> <RelativeLayout android:id="@+id/v_8" android:layout_height="63dp" android:background="#4B0082" android:layout_width="62dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true"/> <RelativeLayout android:id="@+id/v_9" android:layout_height="63dp" android:background="#EE82EE" android:layout_width="63dp" android:layout_below="@id/v_2" android:layout_centerInParent="true" /> <RelativeLayout android:id="@+id/v_10" android:layout_height="63dp" android:background="#FFFF00" android:layout_width="63dp" android:layout_toRightOf="@id/v_2" android:layout_centerInParent="true" /> </RelativeLayout>
作业3
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:layout_margin="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#4CAF50"/> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="4" android:background="#0000FF0D" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#2196F3"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="4" android:background="#02FF5722"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#2196F3"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#4CAF50"/> </LinearLayout>
作业4
<?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:layout_centerVertical="true" android:text="用户" android:textSize="24sp" android:layout_margin="10dp" android:padding="10dp"/> <TextView android:id="@+id/tv_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="密码" android:textSize="24sp" android:layout_margin="10dp" 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_2" android:drawablePadding="10dp" android:inputType="textPassword"/> <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:text="登录" android:textSize="24sp" android:background="#6B21F3"/> <ImageView android:layout_width="70dp" android:layout_height="70dp" android:layout_above="@id/et_1" android:layout_centerInParent="true" android:layout_marginBottom="30dp"></ImageView> </RelativeLayout>