团队成员:陈淑筠、杨家安、陈曦

团队选题:小学四则运算APP

第一次冲刺阶段时间:11.17~11.27

本次发布的是还未完成的功能二(选择题):

ChoiceActivity.java:

  1. package com.example.calculator;
  2.  
  3. import java.util.Random;
  4.  
  5. import android.os.Bundle;
  6. import android.app.ActionBar;
  7. import android.app.Activity;
  8. import android.content.Intent;
  9. import android.view.Menu;
  10. import android.view.MenuItem;
  11. import android.widget.Button;
  12. import android.widget.RadioButton;
  13. import android.widget.TextView;
  14.  
  15. public class ChoiceActivity extends Activity {
  16. private TextView text1,text2,text3;
  17. private RadioButton radioButton1,radioButton2,radioButton3,radioButton4;
  18. private Button btn;
  19.  
  20. private final Random num1=new Random();
  21. private final Random num2=new Random();
  22. private final Random r = new Random();
  23. private int x1;
  24. private int x2;
  25. private int x3;
  26.  
  27. private char[] ch={'+','-','*','/'}; //字符数组
  28. private int index = r.nextInt(ch.length); //随机数,小于数组的长度数, 0~3
  29. private char d=ch[index];
  30.  
  31. @Override
  32. protected void onCreate(Bundle savedInstanceState) {
  33. ActionBar actionBar=getActionBar();
  34. actionBar.setDisplayShowHomeEnabled(true);
  35. actionBar.setDisplayHomeAsUpEnabled(true);
  36. super.onCreate(savedInstanceState);
  37. setContentView(R.layout.activity_choice);
  38. text1=(TextView)findViewById(R.id.textView1);
  39. text2=(TextView)findViewById(R.id.textView2);
  40. text3=(TextView)findViewById(R.id.textView3);
  41. radioButton1=(RadioButton)findViewById(R.id.radioButton1);
  42. radioButton2=(RadioButton)findViewById(R.id.radioButton2);
  43. radioButton3=(RadioButton)findViewById(R.id.radioButton3);
  44. radioButton4=(RadioButton)findViewById(R.id.radioButton4);
  45. btn=(Button)findViewById(R.id.button1);
  46.  
  47. final String a=String.valueOf(num1.nextInt(100));
  48. x1=Integer.valueOf(a);
  49. final String b=String.valueOf(num2.nextInt(100));
  50. x2=Integer.valueOf(b);
  51. final String e=String.valueOf(d);
  52.  
  53. text1.setText(a);
  54. text3.setText(b);
  55. text2.setText(e);
  56.  
  57. radioButton1.setText(a);
  58. radioButton2.setText(b);
  59. }
  60.  
  61. @Override
  62. public boolean onCreateOptionsMenu(Menu menu) {
  63. // Inflate the menu; this adds items to the action bar if it is present.
  64. getMenuInflater().inflate(R.menu.choice, menu);
  65. return true;
  66. }
  67.  
  68. @Override
  69. public boolean onOptionsItemSelected(MenuItem item) {
  70. // TODO Auto-generated method stub
  71. switch (item.getItemId()) {
  72. case android.R.id.home:
  73. //创建启动MainActivity的Intent
  74. Intent intent=new Intent(this,TypesActivity.class);
  75. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  76. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  77. startActivity(intent);
  78. break;
  79.  
  80. default:
  81. break;
  82. }
  83. return super.onOptionsItemSelected(item);
  84. }
  85. }

activity_choice.xml:

  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:paddingBottom="@dimen/activity_vertical_margin"
  6. android:paddingLeft="@dimen/activity_horizontal_margin"
  7. android:paddingRight="@dimen/activity_horizontal_margin"
  8. android:paddingTop="@dimen/activity_vertical_margin"
  9. android:background="@drawable/animal"
  10. tools:context=".ChoiceActivity" >
  11.  
  12. <TextView
  13. android:id="@+id/textView1"
  14. android:layout_width="50dp"
  15. android:layout_height="wrap_content"
  16. android:layout_marginTop="100dp" />
  17.  
  18. <TextView
  19. android:id="@+id/textView2"
  20. android:layout_width="30dp"
  21. android:layout_height="wrap_content"
  22. android:layout_alignBaseline="@+id/textView1"
  23. android:layout_alignBottom="@+id/textView1"
  24. android:layout_toRightOf="@+id/textView1" />
  25.  
  26. <TextView
  27. android:id="@+id/textView3"
  28. android:layout_width="50dp"
  29. android:layout_height="wrap_content"
  30. android:layout_alignBaseline="@+id/textView2"
  31. android:layout_alignBottom="@+id/textView2"
  32. android:layout_toRightOf="@+id/textView2" />
  33.  
  34. <TextView
  35. android:id="@+id/textView4"
  36. android:layout_width="wrap_content"
  37. android:layout_height="wrap_content"
  38. android:layout_alignBaseline="@+id/textView3"
  39. android:layout_alignBottom="@+id/textView3"
  40. android:layout_toRightOf="@+id/textView3"
  41. android:text="=" />
  42.  
  43. <RadioButton
  44. android:id="@+id/radioButton2"
  45. android:layout_width="wrap_content"
  46. android:layout_height="wrap_content"
  47. android:layout_alignLeft="@+id/radioButton1"
  48. android:layout_centerVertical="true" />
  49.  
  50. <RadioButton
  51. android:id="@+id/radioButton3"
  52. android:layout_width="wrap_content"
  53. android:layout_height="wrap_content"
  54. android:layout_alignLeft="@+id/textView3"
  55. android:layout_below="@+id/radioButton2" />
  56.  
  57. <RadioButton
  58. android:id="@+id/radioButton4"
  59. android:layout_width="wrap_content"
  60. android:layout_height="wrap_content"
  61. android:layout_alignLeft="@+id/radioButton3"
  62. android:layout_below="@+id/radioButton3" />
  63.  
  64. <Button
  65. android:id="@+id/button1"
  66. android:layout_width="wrap_content"
  67. android:layout_height="wrap_content"
  68. android:layout_below="@+id/radioButton4"
  69. android:layout_centerHorizontal="true"
  70. android:layout_marginTop="46dp"
  71. android:text="确定" />
  72.  
  73. <RadioButton
  74. android:id="@+id/radioButton1"
  75. android:layout_width="wrap_content"
  76. android:layout_height="wrap_content"
  77. android:layout_above="@+id/radioButton2"
  78. android:layout_toLeftOf="@+id/button1" />
  79.  
  80. </RelativeLayout>

运行结果:

            

小学四则运算APP 第一个冲刺 第八天的更多相关文章

  1. 小学四则运算APP 第一个冲刺阶段 第一天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 思考:初步了解小学四则运算数是在100以内的加减乘除,首先先从简单的地方入手,把最基础的算法功 ...

  2. 小学四则运算APP 第一个冲刺 第七天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是完成的功能一: 程序代码: MainActivity代码: import andr ...

  3. 小学四则运算APP 第一个冲刺阶段 第六天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是重新排列整齐ResultActivity的布局代码activity_result. ...

  4. 小学四则运算APP 第一个冲刺阶段 第五天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是实现练习功能的成功 代码: public class CalculatorActi ...

  5. 小学四则运算APP 第一个冲刺阶段 第四天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布我们增加了CalculatorsActivity.java.YunsuanActivi ...

  6. 小学四则运算APP 第一个冲刺阶段 第三天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...

  7. 小学四则运算APP 第一阶段冲刺 第二天-补

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布已经解决上次问题,问题是写程序逻辑错误,问题已经修改!我们还增加两个模块的面板设置,如 ...

  8. 小学四则运算APP 第一个冲刺 第二天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次程序是为了解决上次判断的问题,但是还是出现新的问题页面无法调整,需要进行改进 本次改进代码 ...

  9. 小学四则运算APP 第一阶段冲刺

    需求分析 1.相关系统分析员向用户初步了解需求,然后用word列出要开发的系统的大功能模块,每个大功能模块有哪些小功能模块,对于有些需求比较明确相关的界面时,在这一步里面可以初步定义好少量的界面.[1 ...

随机推荐

  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 ...

  2. Spring容器技术内幕之内部工作机制

    引言 Spring容器就像一台构造精妙的机器,我们通过配置文件向机器传达控制信息,机器就能够按照设定的模式工作.如果将Spring容器比作一辆车,那么可以将BeanFactory看成汽车的发动机,而A ...

  3. 转://三分钟读懂Oracle数据库容灾架之DataGuard

    目前市场上针对Oracle数据库常见的容灾产品大致可以分为两大类. Oracle 公司自己的容灾产品 非Oracle公司的容灾产品 Oracle公司目前的容灾产品有我们常见的DataGuard和属于中 ...

  4. 关于一台机器部署多个tomcat的小记

    一台机器部署多个tomcat在很多时候都是有可能的,比如说多个tomcat配合nginx负载更可能好的利用CPU,或者更新程序时做主备切换等. 1.直接下载或者复制一个已有的tomcat,第一个tom ...

  5. 20145236《网络对抗》Exp8 WEB基础实践

    20145236<网路对抗>Exp8 WEB基础实践 一.基础问题回答 什么是表单 表单在网页中主要负责数据采集功能 一个表单有三个基本组成部分: 表单标签 表单域:包含了文本框.密码框. ...

  6. hibernate validator 动态返回国际化提示

    一.说明 以下方法实现了读取指定国际化文件的校验器. 1. MyMessages是自定义的国际化文件,放置在src的根目录下 例如有MyMessages_en_US.properties.MyMess ...

  7. mysql 存儲emjoy表情是報錯Incorrect string value:

    解决方法: [mysqld] character-set-client-handshake=FALSE character-set-server=utf8mb4 collation-server=ut ...

  8. Qt+QGIS二次开发:读取矢量元素及其属性

    1  概述矢量图层内矢量元素组成,矢量图层的加载由驱动实现,驱动必须实现对矢量图层内元素的读写操作功能. 2 原理矢量元素包含几何和属性两部分组成.几何部分用于提供图形相关内容.属性部分提供与几何相关 ...

  9. https安全协议原理

    那么什么是HTTPS? HTTPS(Hypertext Transfer Protocol Secure)是一种通过计算机网络进行安全通信的传输协议.HTTPS经由HTTP进行通信,但利用TLS来加密 ...

  10. Redis详解(八)------ 主从复制

    前面介绍Redis,我们都在一台服务器上进行操作的,也就是说读和写以及备份操作都是在一台Redis服务器上进行的,那么随着项目访问量的增加,对Redis服务器的操作也越加频繁,虽然Redis读写速度都 ...