安卓第1-2周作业
作业1:安装环境,截图编程界面,截图运行界面
作业2:九宫格
<?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=".MainActivity2"> <RelativeLayout android:layout_width="300dp" android:layout_height="300dp" android:layout_centerInParent="true" android:background="#000000"> <View android:id="@+id/v_1" android:layout_width="100dp" android:layout_height="100dp" android:background="#FFFFFF" android:layout_centerInParent="true"/> <View android:layout_width="100dp" android:layout_height="100dp" android:layout_above="@id/v_1" android:layout_alignLeft="@id/v_1" android:background="#424200"/> <View android:layout_width="100dp" android:layout_height="100dp" android:layout_below="@id/v_1" android:layout_alignLeft="@id/v_1" android:background="#324777"/> <View android:id="@+id/v_2" android:layout_width="100dp" android:layout_height="100dp" android:layout_toLeftOf="@id/v_1" android:layout_alignTop="@id/v_1" android:background="#213000"/> <View android:id="@+id/v_3" android:layout_width="100dp" android:layout_height="100dp" android:layout_toRightOf="@id/v_1" android:layout_alignTop="@id/v_1" android:background="#2828ff"/> <View android:layout_width="100dp" android:layout_height="100dp" android:layout_above="@id/v_1" android:background="#f75000"/> <View android:layout_width="100dp" android:layout_height="100dp" android:layout_below="@id/v_1" android:background="#642100"/> <View android:layout_width="100dp" android:layout_height="100dp" android:layout_below="@id/v_3" android:layout_alignLeft="@id/v_3" android:background="#467500"/> </RelativeLayout> </RelativeLayout>
作业3:布局界面(QQ群截图)
<?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"> <LinearLayout android:layout_width="match_parent" android:layout_height="500dp" android:layout_centerInParent="true" android:background="#FFFFFF" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#AE0000"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:background="#000000" /> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#006030" /> </LinearLayout> </RelativeLayout>
作业3:制作登录界面(要求至少2个edittext,1个button,最好有一个imageview要求美观)
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_1" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/image_1" android:layout_width="150dp" android:layout_height="150dp" android:background="@mipmap/ic_launcher" android:layout_centerHorizontal="true" android:layout_marginTop="100dp"/> <EditText android:id="@+id/zhanghao" android:layout_width="match_parent" android:layout_height="50dp" android:layout_margin="20dp" android:paddingLeft="20dp" android:hint="请输入账号" android:background="@drawable/log" android:layout_below="@id/image_1" android:layout_marginTop="40dp"/> <EditText android:id="@+id/mima" android:layout_width="match_parent" android:layout_height="50dp" android:layout_margin="20dp" android:paddingLeft="20dp" android:hint="请输入密码" android:background="@drawable/log" android:layout_below="@id/zhanghao" android:layout_marginTop="40dp"/> <Button android:layout_width="150dp" android:layout_height="60dp" android:layout_below="@id/mima" android:layout_centerHorizontal="true" android:text="登录" android:textColor="#ffffff" android:background="@drawable/btnlog" android:textSize="25sp"/> </RelativeLayout>