第一、二周作业
1.
2.
作业2:九宫格 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <View android:id="@+id/view_1" android:layout_width="100dp" android:layout_height="100dp" android:background="#000000"/> <View android:id="@+id/view_2" android:layout_width="100dp" android:layout_height="100dp" android:background="#F44336" android:layout_below="@+id/view_1"/> <View android:id="@+id/view_3" android:layout_width="100dp" android:layout_height="100dp" android:background="#E91E63" android:layout_below="@+id/view_2" /> <View android:id="@+id/view_4" android:layout_width="100dp" android:layout_height="100dp" android:background="#9C27B0" android:layout_toRightOf="@+id/view_1"/> <View android:id="@+id/view_5" android:layout_width="100dp" android:layout_height="100dp" android:background="#673AB7" android:layout_toRightOf="@+id/view_4"/> <View android:id="@+id/view_6" android:layout_width="100dp" android:layout_height="100dp" android:background="#3F51B5" android:layout_below="@+id/view_1" android:layout_toRightOf="@id/view_2"/> <View android:id="@+id/view_7" android:layout_width="100dp" android:layout_height="100dp" android:background="#2196F3" android:layout_toRightOf="@+id/view_6" android:layout_below="@id/view_1"/> <View android:id="@+id/view_8" android:layout_width="100dp" android:layout_height="100dp" android:background="#FFEB3B" android:layout_toRightOf="@+id/view_1" android:layout_below="@id/view_2"/> <View android:id="@+id/view_9" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF5722" android:layout_toRightOf="@+id/view_8" android:layout_below="@id/view_2"/> </RelativeLayout>
3.
布局界面(QQ群截图) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff"> <View android:id="@+id/view_1" android:layout_width="match_parent" android:layout_height="100dp" android:background="#00ff33"/> <View android:id="@+id/view_2" android:layout_width="100dp" android:layout_height="520dp" android:background="#F44336" android:layout_below="@id/view_1"/> <View android:id="@+id/view_3" android:layout_width="210dp" android:layout_height="520dp" android:background="#03A9F4" android:layout_below="@id/view_1" android:layout_toRightOf="@id/view_2"/> <View android:id="@+id/view_4" android:layout_width="100dp" android:layout_height="520dp" android:background="#FFEB3B" android:layout_below="@id/view_1" android:layout_toRightOf="@id/view_3"/> <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/view_2" android:background="#9C27B0" </RelativeLayout>
4.
制作登录界面(要求至少2个edittext,1个button,最好有一个imageview要求美观) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageButton android:id="@+id/v_1" android:layout_width="150dp" android:layout_height="150dp" android:src="@drawable/ic_launcher_background" android:layout_above="@id/v_2" android:layout_centerInParent="true" ></ImageButton> <EditText android:id="@+id/v_2" android:layout_width="match_parent" android:layout_height="60dp" android:hint="用户名" android:background="#43A39F9F" android:layout_marginLeft="10dp" android:textColor="#000000" android:textSize="15sp" android:padding="10dp" android:layout_margin="15dp" android:drawablePadding="10dp" android:layout_centerInParent="true"></EditText> <EditText android:id="@+id/v_3" android:layout_width="match_parent" android:layout_height="60dp" android:layout_below="@id/v_2" android:layout_marginStart="15dp" android:layout_marginLeft="15dp" android:layout_marginTop="30dp" android:layout_marginEnd="15dp" android:layout_marginRight="15dp" android:layout_marginBottom="15dp" android:background="#43A39F9F" android:drawablePadding="10dp" android:hint="密码" android:padding="10dp" android:textColor="#000000" android:textSize="15sp"></EditText> <Button android:id="@+id/btn_1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#72BCFF" android:textColor="#ffffff" android:layout_below="@id/v_3" android:layout_margin="15dp" android:text="登录"></Button> </RelativeLayout>