AS课堂练习——世界杯调查问卷

目的

根据书本例题设计问卷的界面,并实现功能

工具及环境

使用java语言,在Android studio平台上进行开发

功能设计

实现提交按钮显示选择的信息以及实现重置按钮的重置功能

设计思路

先根据书本的界面设计界面,然后根据自己的需求调整美化一下界面,之后思考学习按“提交”按钮输出选择信息,按“重置”按钮实现界面重置的功能。

代码

strings.xml 

<resources>
    <string name="app_name">World Cup</string>
    <string name="txt_1">球王“贝利”是哪个国家的人:</string>
    <string name="radio_1">巴西</string>
    <string name="radio_2">德国</string>
    <string name="radio_3">美国</string>
    <string name="radio_4">法国</string>
    <string name="txt_2">下列足球队中,哪些队曾获得世界杯冠军:</string>
    <string name="checkbox_1">法国国家队</string>
    <string name="checkbox_2">中国国家队</string>
    <string name="checkbox_3">巴西国家队</string>
    <string name="checkbox_4">美国国家队</string>
    <string name="btn_1">提交</string>
    <string name="btn_2">重置</string>
</resources>

activity_main.xml(UI设计)

<?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"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15sp"
        android:text="@string/txt_1"
        android:textSize="20dp"
        android:textColor="#000000"
       />
    <RadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15sp"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/radio1"
            android:text="@string/radio_1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textSize="18dp"/&g
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值