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

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

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

本次发布的是重新排列整齐ResultActivity的布局代码activity_result.xml

代码如下:

activity_result.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"
android:scrollbars="vertical"
tools:context=".ResultActivity" > <TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:text="@string/result"
android:textSize="30sp"/> <TextView
android:id="@+id/sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="44dp"
android:text="TextView"
android:textSize="20sp"/> <TextView
android:id="@+id/thenumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/textView2"
android:layout_marginTop="23dp"
android:text="TextView" /> <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView2"
android:layout_alignBottom="@+id/textView2"
android:layout_alignRight="@+id/panduan"
android:text="@string/panduan"
android:textSize="20sp" /> <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@+id/textView1"
android:text="@string/number"
android:textSize="20sp" /> <TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView5"
android:layout_alignBaseline="@+id/textView3"
android:layout_alignBottom="@+id/textView3"
android:layout_alignRight="@+id/sum"
android:text="@string/trueresult"
android:textSize="20sp" /> <TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/thenumber"
android:layout_alignBottom="@+id/thenumber"
android:layout_centerHorizontal="true"
android:text="TextView" /> <TextView
android:id="@+id/panduan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView5"
android:layout_alignBottom="@+id/textView5"
android:layout_toRightOf="@+id/textView1"
android:text="TextView" /> </RelativeLayout>

ResultActivity.java:

package com.example.calculator;

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.TextView; public class ResultActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
ActionBar actionBar=getActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
Intent inten=getIntent();
Bundle bundle=inten.getExtras();
TextView text1=(TextView)findViewById(R.id.thenumber);
TextView text=(TextView)findViewById(R.id.panduan);
TextView text2=(TextView)findViewById(R.id.sum);
TextView text3=(TextView)findViewById(R.id.textView5);
int[] shu1=inten.getIntArrayExtra("shu1");
int[] shu2=inten.getIntArrayExtra("shu2");
int[] result=inten.getIntArrayExtra("result");
int suanfa=bundle.getInt("suanfa");
String time=bundle.getString("time");
String showfa="";
if(suanfa==1){showfa="+";}
if(suanfa==2){showfa="-";}
if(suanfa==3){showfa="*";}
if(suanfa==4){showfa="/";}
String[] user=inten.getStringArrayExtra("user");
String aaa="";
String bbb="";
String ccc="";
int score=0;
String show4;
String[] jie=new String[]{"正确","错误"}; for (int i=0;i<shu1.length;i++){
String show1="";
String show2="";
String show3="";
show1=Integer.toString(shu1[i]);
show2=Integer.toString(shu2[i]);
show3=Integer.toString(result[i]); if(user[i].equals(show3)){show4=jie[0];score++;}
else { show4=jie[1];}
aaa+=show4+"\n";
bbb+=show1+showfa+show2+"="+show3+"\n";
ccc+=user[i]+"\n";
text.setText(aaa);
text1.setText(bbb);
text3.setText(ccc); }
text2.setText(time+"总得分为"+score*10);
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.result, 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,CalculatorsActivity.class);
//添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break; default:
break;
}
return super.onOptionsItemSelected(item);
} }

总结:布局代码未出错,可是运行时“正确答案”却和“判断”重叠了,我们将继续研究,解决当前问题!

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

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

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

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

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

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

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

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

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

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

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是还未完成的功能二(选择题): ChoiceActivity.java: packa ...

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

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

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

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

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

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是已完成的功能二(选择题): ChoiceActivity.java: packag ...

  9. 小学四则运算APP 第二次冲刺 第四天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是合并后的选择题功能界面的设置: ChoiceSet.java: package c ...

随机推荐

  1. 17秋 软件工程 团队第五次作业 Alpha Scrum9

    17秋 软件工程 团队第五次作业 Alpha Scrum9 今日完成的任务 世强:APP后端部门申请状态: 港晨:主页面代码实现: 树民:完善超级管理员web后端: 伟航:设置页面和侧边栏的原型: 陈 ...

  2. C#用默认浏览器打开特定网址的几种方法

    方法一:从注册表中读取默认浏览器可执行文件路径 private void button1_Click(object sender, EventArgs e) { //从注册表中读取默认浏览器可执行文件 ...

  3. Matplotlib入门

    使用之前首先下载:pip install  Matplotlib 接着引入:import matplotlib.pylot as plt 绘图函数:plt.plot() 显示函数:plt.show() ...

  4. Excel中row函数的使用方法

    1.row函数的含义 1 row函数的含义 返回所选择的某一个单元格的行数. END 2.row函数的语法格式 1 row函数的语法格式 =row(reference) 如果省略reference,则 ...

  5. 课程设计小组报告——基于ARM实验箱的捕鱼游戏的设计与实现

    课程设计小组报告--基于ARM实验箱的捕鱼游戏的设计与实现 一.任务简介 1.1 任务内容 捕鱼游戏这个项目是一个娱乐性的游戏开发,该游戏可以给人们带来娱乐的同时还可以给人感官上的享受,所以很受人们的 ...

  6. nginx的server块如何支持php

    直接贴代码,备份用 server { listen ; server_name abc.com; index index.html index.htm index.php; root /var/www ...

  7. spring 基于注解的@Scheduled和quartz定时器两种实现

    一.使用quartz 1.由于我的项目jar包使用的maven托管的,在pom文件中加入quartz的依赖就可以 2.配置quartz-context.xml,确保xml文件能被加载到 <?xm ...

  8. PAT A1115 Counting Nodes in a BST (30 分)——二叉搜索树,层序遍历或者dfs

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  9. ubuntu 环境下的QT程序打包

    很多的时候 需要将自己写的QT 程序发布一下  所以今天教一下 怎么在ubuntu 环境下将自己的写的Qt 程序打包打包是为了不依赖 开发环境 和开发的库. 1. QtCreate使用Release版 ...

  10. 在 Virtual Box 安装 Mac Os 并安装 Qt 开发应用

    导读 由于 Beslyric-for-X 项目开发需要,开始尝试在 Mac Os 下开发 Qt 应用.尝试成功后,记录于此,希望对有类似需求的人有所帮助. 本文以开发 Beslyric-for-X 为 ...