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>