Android页面跳转考试系统选择题

Activity_main.xml

MainActivity.java

package com.example.zsintent;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
    private Button btn_next;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn_next=findViewById(R.id.button_next);
        btn_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(MainActivity.this,SecondActivity.class);
                startActivity(intent);
            }
        });
    }
}

选择题1-4题关键代码分别如下:

第一题:Activity_Second.xml

<?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"
    android:background="@drawable/bjt"
    tools:context=".SecondActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="选择题"
        android:width="150dp"
        android:textColor="#03A9F4"
        android:textSize="50dp"/>
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#151413"
        android:textSize="30dp"
        android:text="1.以下()控件来显示文本" />
    <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <RadioButton
            android:id="@+id/radioButtonA"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="A. ImageView" />
        <RadioButton
            android:id="@+id/radioButtonB"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="B. TextView" />
        <RadioButton
            android:id="@+id/radioButtonC"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="C. EditText" />
        <RadioButton
            android:id="@+id/radioButtonD"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="D. Button" />
    </RadioGroup>
    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#F5ED0736"
        android:text="" />
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="下一题" />
</LinearLayout>

SecondActivity.java

第2题:Activity_Three.xml

<?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"
    android:background="@drawable/bjt"
    tools:context=".ThreeActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="选择题"
        android:width="150dp"
        android:textColor="#03A9F4"
        android:textSize="50dp"/>
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#151413"
        android:textSize="30dp"
        android:text="2.以下()属性用来设置控件的宽度" />
    <RadioGroup
        android:id="@+id/radioGroup3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <RadioButton
        android:id="@+id/radioButtonA"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="A. width" />
    <RadioButton
        android:id="@+id/radioButtonB"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="B. height" />
    <RadioButton
        android:id="@+id/radioButtonC"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="C. text" />
    <RadioButton
        android:id="@+id/radioButtonD"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="D. id" />
    </RadioGroup>
    <TextView
        android:id="@+id/textView3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#F5ED0736"
        android:text="" />
    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="上一题" />
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="下一题" />
</LinearLayout>

ThreeActivity.java

<?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"
    android:background="@drawable/bjt"
    tools:context=".FourActivity">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="选择题"
        android:width="150dp"
        android:textColor="#03A9F4"
        android:textSize="50dp"
        />
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#151413"
        android:textSize="30dp"
        android:text="3.以下()属性用来设置控件字体的颜色。" />
    <RadioGroup
        android:id="@+id/radioGroup4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <RadioButton
        android:id="@+id/radioButtonA"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="A. textStyle" />
    <RadioButton
        android:id="@+id/radioButtonB"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="B. textSize" />
    <RadioButton
        android:id="@+id/radioButtonC"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="C. textColor" />
    <RadioButton
        android:id="@+id/radioButtonD"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="D. Color" />
    </RadioGroup>
    <TextView
        android:id="@+id/textView4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#F5ED0736"
        android:text="" />
    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="上一题" />
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="下一题" />

</LinearLayout>

第4题代码:activity_four.xml

<?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"
    android:background="@drawable/bjt"
    tools:context=".FiveActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="选择题"
        android:width="150dp"
        android:textColor="#03A9F4"
        android:textSize="50dp"/>
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#151413"
        android:textSize="30dp"
        android:text="4.Android中,导入类文件的快捷键是()" />
    <RadioGroup
        android:id="@+id/radioGroup5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <RadioButton
        android:id="@+id/radioButtonA"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="A. Alt+Enter" />

    <RadioButton
        android:id="@+id/radioButtonB"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="B. Ctrl+Alt+Delete" />
    </RadioGroup>
    <TextView
        android:id="@+id/textView5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#F5ED0736"
        android:text="" />
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="上一题" />

</LinearLayout>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值