Android实训案例(九)——答题系统的思绪,自己设计一个题库的体验,一个思路清晰的答题软件制作过程
项目也是偷师的,决心研究一下数据库。所以写的还是很详细的,各位看官,耐着性子看完,实现结果不重要,思路一定要清晰,我们做一个简单的项目,所以也就设计的比较简陋了,首先新建一个项目——AnswerSystem
一.实现项目框架
主页面就是一个问题,四个答案,还有一个正确答案,最后就是翻页了,正确答案默认是隐藏的,所以我们的layout_mian.xml是这样实现的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="问:刘桂林是何许人也?"
android:textColor="@color/colorAccent"
android:textSize="22sp"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/mRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<!--四个选项-->
<RadioButton
android:id="@+id/RadioA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="大帅哥" />
<RadioButton
android:id="@+id/RadioB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="参照A" />
<RadioButton
android:id="@+id/RadioC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="参照B" />
<RadioButton
android:id="@+id/RadioD"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="参照C" />
<!--正确答案,默认是隐藏的-->
<TextView
an