小学四则运算APP 第一个冲刺 第八天
团队成员:陈淑筠、杨家安、陈曦
团队选题:小学四则运算APP
第一次冲刺阶段时间:11.17~11.27
本次发布的是还未完成的功能二(选择题):
ChoiceActivity.java:
- package com.example.calculator;
- import java.util.Random;
- import android.os.Bundle;
- import android.app.ActionBar;
- import android.app.Activity;
- import android.content.Intent;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.widget.Button;
- import android.widget.RadioButton;
- import android.widget.TextView;
- public class ChoiceActivity extends Activity {
- private TextView text1,text2,text3;
- private RadioButton radioButton1,radioButton2,radioButton3,radioButton4;
- private Button btn;
- private final Random num1=new Random();
- private final Random num2=new Random();
- private final Random r = new Random();
- private int x1;
- private int x2;
- private int x3;
- private char[] ch={'+','-','*','/'}; //字符数组
- private int index = r.nextInt(ch.length); //随机数,小于数组的长度数, 0~3
- private char d=ch[index];
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- ActionBar actionBar=getActionBar();
- actionBar.setDisplayShowHomeEnabled(true);
- actionBar.setDisplayHomeAsUpEnabled(true);
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_choice);
- text1=(TextView)findViewById(R.id.textView1);
- text2=(TextView)findViewById(R.id.textView2);
- text3=(TextView)findViewById(R.id.textView3);
- radioButton1=(RadioButton)findViewById(R.id.radioButton1);
- radioButton2=(RadioButton)findViewById(R.id.radioButton2);
- radioButton3=(RadioButton)findViewById(R.id.radioButton3);
- radioButton4=(RadioButton)findViewById(R.id.radioButton4);
- btn=(Button)findViewById(R.id.button1);
- final String a=String.valueOf(num1.nextInt(100));
- x1=Integer.valueOf(a);
- final String b=String.valueOf(num2.nextInt(100));
- x2=Integer.valueOf(b);
- final String e=String.valueOf(d);
- text1.setText(a);
- text3.setText(b);
- text2.setText(e);
- radioButton1.setText(a);
- radioButton2.setText(b);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.choice, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // TODO Auto-generated method stub
- switch (item.getItemId()) {
- case android.R.id.home:
- //创建启动MainActivity的Intent
- Intent intent=new Intent(this,TypesActivity.class);
- //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- break;
- default:
- break;
- }
- return super.onOptionsItemSelected(item);
- }
- }
activity_choice.xml:
- <RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:background="@drawable/animal"
- tools:context=".ChoiceActivity" >
- <TextView
- android:id="@+id/textView1"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="100dp" />
- <TextView
- android:id="@+id/textView2"
- android:layout_width="30dp"
- android:layout_height="wrap_content"
- android:layout_alignBaseline="@+id/textView1"
- android:layout_alignBottom="@+id/textView1"
- android:layout_toRightOf="@+id/textView1" />
- <TextView
- android:id="@+id/textView3"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:layout_alignBaseline="@+id/textView2"
- android:layout_alignBottom="@+id/textView2"
- android:layout_toRightOf="@+id/textView2" />
- <TextView
- android:id="@+id/textView4"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignBaseline="@+id/textView3"
- android:layout_alignBottom="@+id/textView3"
- android:layout_toRightOf="@+id/textView3"
- android:text="=" />
- <RadioButton
- android:id="@+id/radioButton2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/radioButton1"
- android:layout_centerVertical="true" />
- <RadioButton
- android:id="@+id/radioButton3"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/textView3"
- android:layout_below="@+id/radioButton2" />
- <RadioButton
- android:id="@+id/radioButton4"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/radioButton3"
- android:layout_below="@+id/radioButton3" />
- <Button
- android:id="@+id/button1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/radioButton4"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="46dp"
- android:text="确定" />
- <RadioButton
- android:id="@+id/radioButton1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_above="@+id/radioButton2"
- android:layout_toLeftOf="@+id/button1" />
- </RelativeLayout>
运行结果:
小学四则运算APP 第一个冲刺 第八天的更多相关文章
- 小学四则运算APP 第一个冲刺阶段 第一天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 思考:初步了解小学四则运算数是在100以内的加减乘除,首先先从简单的地方入手,把最基础的算法功 ...
- 小学四则运算APP 第一个冲刺 第七天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是完成的功能一: 程序代码: MainActivity代码: import andr ...
- 小学四则运算APP 第一个冲刺阶段 第六天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是重新排列整齐ResultActivity的布局代码activity_result. ...
- 小学四则运算APP 第一个冲刺阶段 第五天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是实现练习功能的成功 代码: public class CalculatorActi ...
- 小学四则运算APP 第一个冲刺阶段 第四天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布我们增加了CalculatorsActivity.java.YunsuanActivi ...
- 小学四则运算APP 第一个冲刺阶段 第三天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...
- 小学四则运算APP 第一阶段冲刺 第二天-补
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布已经解决上次问题,问题是写程序逻辑错误,问题已经修改!我们还增加两个模块的面板设置,如 ...
- 小学四则运算APP 第一个冲刺 第二天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次程序是为了解决上次判断的问题,但是还是出现新的问题页面无法调整,需要进行改进 本次改进代码 ...
- 小学四则运算APP 第一阶段冲刺
需求分析 1.相关系统分析员向用户初步了解需求,然后用word列出要开发的系统的大功能模块,每个大功能模块有哪些小功能模块,对于有些需求比较明确相关的界面时,在这一步里面可以初步定义好少量的界面.[1 ...
随机推荐
- i.s.h.med Enhancement for cancelling an appointment
This article intends to introduce my experience about enhancement for canceling an appointment. I tr ...
- Spring容器技术内幕之内部工作机制
引言 Spring容器就像一台构造精妙的机器,我们通过配置文件向机器传达控制信息,机器就能够按照设定的模式工作.如果将Spring容器比作一辆车,那么可以将BeanFactory看成汽车的发动机,而A ...
- 转://三分钟读懂Oracle数据库容灾架之DataGuard
目前市场上针对Oracle数据库常见的容灾产品大致可以分为两大类. Oracle 公司自己的容灾产品 非Oracle公司的容灾产品 Oracle公司目前的容灾产品有我们常见的DataGuard和属于中 ...
- 关于一台机器部署多个tomcat的小记
一台机器部署多个tomcat在很多时候都是有可能的,比如说多个tomcat配合nginx负载更可能好的利用CPU,或者更新程序时做主备切换等. 1.直接下载或者复制一个已有的tomcat,第一个tom ...
- 20145236《网络对抗》Exp8 WEB基础实践
20145236<网路对抗>Exp8 WEB基础实践 一.基础问题回答 什么是表单 表单在网页中主要负责数据采集功能 一个表单有三个基本组成部分: 表单标签 表单域:包含了文本框.密码框. ...
- hibernate validator 动态返回国际化提示
一.说明 以下方法实现了读取指定国际化文件的校验器. 1. MyMessages是自定义的国际化文件,放置在src的根目录下 例如有MyMessages_en_US.properties.MyMess ...
- mysql 存儲emjoy表情是報錯Incorrect string value:
解决方法: [mysqld] character-set-client-handshake=FALSE character-set-server=utf8mb4 collation-server=ut ...
- Qt+QGIS二次开发:读取矢量元素及其属性
1 概述矢量图层内矢量元素组成,矢量图层的加载由驱动实现,驱动必须实现对矢量图层内元素的读写操作功能. 2 原理矢量元素包含几何和属性两部分组成.几何部分用于提供图形相关内容.属性部分提供与几何相关 ...
- https安全协议原理
那么什么是HTTPS? HTTPS(Hypertext Transfer Protocol Secure)是一种通过计算机网络进行安全通信的传输协议.HTTPS经由HTTP进行通信,但利用TLS来加密 ...
- Redis详解(八)------ 主从复制
前面介绍Redis,我们都在一台服务器上进行操作的,也就是说读和写以及备份操作都是在一台Redis服务器上进行的,那么随着项目访问量的增加,对Redis服务器的操作也越加频繁,虽然Redis读写速度都 ...