AS第三周作业

1.

<?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:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:id="@+id/btn_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="按钮1"
        android:background="#999999"
        android:textColor="#0D0E0E"
        android:layout_margin="10dp"
        />
    <Button
        android:id="@+id/btn_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="按钮2"
        android:background="#999999"
        android:textColor="#080909"
        android:layout_margin="10dp"
        />

    <Button
        android:id="@+id/btn_3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="按钮3"
        android:background="#999999"
        android:textColor="#0A0A0A"
        android:layout_margin="10dp"
        />

</LinearLayout>

 

<?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:padding="15dp"
    android:background="#00ffff">

    <RadioGroup
        android:id="@+id/rg_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <RadioButton
            android:id="@+id/rb_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="初中"
            android:textColor="#ff0000"
            android:textSize="40sp" />

        <RadioButton
            android:id="@+id/rb_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="高中"
            android:textColor="#ff0000"
            android:textSize="40sp" />

        <RadioButton
            android:id="@+id/rb_3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="大专"
            android:textColor="#ff0000"
            android:textSize="40sp" />

        <RadioButton
            android:id="@+id/rb_4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="本科"
            android:textColor="#ff0000"
            android:textSize="40sp" />
    </RadioGroup>

</RelativeLayout>

 

<?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:padding="15dp"
    android:background="#00ffff">

    <TextView
        android:id="@+id/tv_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="学过哪些课程"
        android:textSize="60sp"
        android:textColor="#ff0000"
        android:layout_marginBottom="20dp"/>

    <CheckBox
        android:id="@+id/cb_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Java"
        android:textSize="35sp"
        android:layout_below="@id/tv_title"
        />

    <CheckBox
        android:id="@+id/cb_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="IOS"
        android:textSize="35sp"
        android:layout_below="@id/cb_1"
        />

    <CheckBox
        android:id="@+id/cb_3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Android"
        android:textSize="35sp"
        android:layout_below="@id/cb_2"
        />

    <CheckBox
        android:id="@+id/cb_4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Html"
        android:textSize="35sp"
        android:layout_below="@id/cb_3"
        />
    <CheckBox
        android:id="@+id/cb_5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Jsp"
        android:textSize="35sp"
        android:layout_below="@id/cb_4"
        />

 

 

2.

package com.example.lyf005;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private Button btn3;
    private Button btn2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        btn3=findViewById(R.id.btn_3);
        btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,"按钮3被点击",Toast.LENGTH_LONG).show();
            }
        });

        btn2=findViewById(R.id.btn_2);
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,"按钮2被点击",Toast.LENGTH_SHORT).show();
            }
        });
    }

    public void click1(View view){
        Toast.makeText(this,"按钮1被点击",Toast.LENGTH_LONG).show();
    }
}

3.

<?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:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/tp1"
        android:layout_gravity="center"
        android:layout_marginTop="80dp"/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="请输入手机号/邮箱"
        android:layout_marginTop="40dp"
        android:gravity="center" />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:hint="请输入密码"
        android:gravity="center"
        android:drawableRight="@drawable/tp2"
        android:drawablePadding="10dp"
        android:layout_marginTop="10dp"/>
    <Button
        android:layout_width="400dp"
        android:layout_height="50dp"
        android:text="登录"
        android:textColor="#ffffff"
        android:gravity="center"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:background="#999999"
        />
    <Button
        android:layout_width="400dp"
        android:layout_height="50dp"
        android:text="不注册,跳过登录"
        android:textColor="#FFFFFF"
        android:gravity="center"
        android:layout_gravity="center"
        android:background="#000000"
        android:layout_marginTop="10dp" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册账号"
            android:layout_margin="10dp"
            android:layout_alignParentLeft="true" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册账号"
            android:layout_margin="10dp"
            android:layout_alignParentRight="true" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/tp3"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="100dp"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/tp4"
            android:layout_centerInParent="true"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/tp5"
            android:layout_alignParentRight="true"
            android:layout_marginRight="100dp"/>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <CheckBox
            android:id="@+id/a1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp" />
        <TextView
            android:id="@+id/a2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="已阅读并同意"
            android:layout_toRightOf="@+id/a1"
            android:padding="5dp"/>
        <TextView
            android:id="@+id/a3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="《用户协议》"
            android:textColor="#FA0606"
            android:layout_toRightOf="@id/a2"
            android:padding="5dp"/>
        <TextView
            android:id="@+id/a4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="和"
            android:layout_toRightOf="@id/a3"
            android:padding="5dp"/>
        <TextView
            android:id="@+id/a5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="《隐私政策》"
            android:textColor="#FA0606"
            android:layout_toRightOf="@id/a4"
            android:padding="5dp"/>

    </RelativeLayout>

</LinearLayout>

posted @ 2021-09-03 10:19  刘源丰  阅读(26)  评论(0编辑  收藏  举报