Android第1、2周作业
1.安装界面
2.九宫格
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/r_0" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#2EFEF7"> <LinearLayout android:id="@+id/l_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerInParent="true"> <View android:id="@+id/v_4" android:layout_width="100dp" android:layout_height="100dp" android:background="#00ff00"/> <View android:id="@+id/v_5" android:layout_width="100dp" android:layout_height="100dp" android:background="#F7FE2E"/> <View android:id="@+id/v_6" android:layout_width="100dp" android:layout_height="100dp" android:background="#0000FF"/> </LinearLayout> <LinearLayout android:id="@+id/l_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/l_2" android:layout_alignLeft="@id/l_2" android:orientation="horizontal"> <View android:id="@+id/v_1" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF00FF"/> <View android:id="@+id/v_2" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF0000"/> <View android:id="@+id/v_3" android:layout_width="100dp" android:layout_height="100dp" android:background="#FFFFFF"/> </LinearLayout> <LinearLayout android:id="@+id/l_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/l_2" android:layout_alignLeft="@id/l_2" android:orientation="horizontal"> <View android:id="@+id/v_7" android:layout_width="100dp" android:layout_height="100dp" android:background="#FFBF00"/> <View android:id="@+id/v_8" android:layout_width="100dp" android:layout_height="100dp" android:background="#7401DF"/> <View android:id="@+id/v_9" android:layout_width="100dp" android:layout_height="100dp" android:background="#000000"/> </LinearLayout> </RelativeLayout>
3.布局界面
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:background="#ffffff" 7 android:orientation="vertical"> 8 <View android:id="@+id/v_1" 9 android:layout_width="match_parent" 10 android:layout_height="100dp" 11 android:background="#00FF00"/> 12 <View android:id="@+id/v_4" 13 android:layout_width="match_parent" 14 android:layout_height="100dp" 15 android:background="#dd0000" 16 android:layout_alignParentBottom="true"/> 17 <View android:id="@+id/v_2" 18 android:layout_width="80dp" 19 android:layout_height="match_parent" 20 android:background="#ff00ff" 21 android:layout_alignParentLeft="true" 22 android:layout_below="@id/v_1" 23 android:layout_above="@id/v_4"/> 24 <View android:id="@+id/v_3" 25 android:layout_width="80dp" 26 android:layout_height="match_parent" 27 android:background="#00ccff" 28 android:layout_alignParentRight="true" 29 android:layout_below="@id/v_1" 30 android:layout_above="@id/v_4"/> 31 32 </RelativeLayout>
4.登录界面
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:background="#e6e6e6"> 6 7 <ImageView 8 android:id="@+id/T_1" 9 android:layout_width="100dp" 10 android:layout_height="100dp" 11 android:layout_centerHorizontal="true" 12 android:layout_marginTop="100dp" 13 android:src="@drawable/t666" /> 14 15 <LinearLayout 16 android:id="@+id/id" 17 android:layout_width="match_parent" 18 android:layout_height="wrap_content" 19 android:layout_below="@id/T_1" 20 android:layout_marginLeft="10dp" 21 android:layout_marginTop="50dp" 22 android:layout_marginRight="10dp" 23 android:orientation="horizontal"> 24 25 <TextView 26 android:id="@+id/id_1" 27 android:layout_width="wrap_content" 28 android:layout_height="wrap_content" 29 android:background="#ffffff" 30 android:text="账号:" 31 android:textSize="50sp" /> 32 33 <EditText 34 android:id="@+id/id_2" 35 android:layout_width="match_parent" 36 android:layout_height="wrap_content" 37 android:background="@null" 38 android:hint="请输入账号" 39 android:maxLines="1" 40 android:textSize="40sp" /> 41 </LinearLayout> 42 43 <LinearLayout 44 android:id="@+id/pass" 45 android:layout_width="match_parent" 46 android:layout_height="wrap_content" 47 android:layout_below="@id/id" 48 android:layout_marginLeft="10dp" 49 android:layout_marginTop="10dp" 50 android:layout_marginRight="10dp"> 51 52 <TextView 53 android:id="@+id/pass_1" 54 android:layout_width="wrap_content" 55 android:layout_height="wrap_content" 56 android:background="#ffffff" 57 android:text="密码:" 58 android:textSize="50sp" /> 59 60 <EditText 61 android:id="@+id/pass_2" 62 android:layout_width="match_parent" 63 android:layout_height="wrap_content" 64 android:background="@null" 65 android:hint="请输入密码" 66 android:maxLines="1" 67 android:textSize="40sp" /> 68 </LinearLayout> 69 70 <Button 71 android:layout_width="match_parent" 72 android:layout_height="wrap_content" 73 android:layout_marginLeft="20dp" 74 android:layout_marginRight="20dp" 75 android:text="登录" 76 android:textSize="40sp" 77 android:layout_below="@id/pass" 78 android:layout_marginTop="50dp" 79 android:background="#0080FF"/> 80 81 82 </RelativeLayout>