第二阶段第3天冲刺

第二阶段第4天冲刺

【开发环境】:eclipse

【开发项目】:小学生四则运算APP

【开发人员】:郑胜斌 http://www.cnblogs.com/zsb1/            

                   孔德颖 http://www.cnblogs.com/kong21/

                   李豌湄 http://www.cnblogs.com/leewanmei/    

                   江丹仪 http://www.cnblogs.com/JDY64/

今天是已经是第二阶段冲刺的第4天了,我们小组在第一阶段收集算法,理解完算法后,纷纷都在讨论app的背景以及如何完善的问题,我和孔德颖主要是负责qpp的算法,李豌湄和江丹仪则是收集背景图片、图标、背景音乐以及数据测试。经过一些大家的努力,这个app总算有个轮廓了。背景音乐那块因为有bug,所以暂时不放出来演示。以下为APP代码及图片演示,欢迎大家复制去运行也是没问题哒:

类:

package com.de.sizhe;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

    private Button btn1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        final Intent intent=new Intent(MainActivity.this,TixingActivity.class);
        btn1=(Button) findViewById(R.id.jinru);
        btn1.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                startActivity(intent);
                finish();
            }
        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
MainActivity
package com.de.sizhe;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class TixingActivity extends Activity {

    private Button chubtn,zhongbtn,gaobtn;
    private EditText edtishu;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tixing);
        
        chubtn=(Button) findViewById(R.id.chuji);
        zhongbtn=(Button) findViewById(R.id.zhongji);
        
        gaobtn=(Button) findViewById(R.id.gaoji);        
        edtishu=(EditText) findViewById(R.id.tishu);
        
        chubtn.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent=new Intent(TixingActivity.this,ChujiActivity.class);
                Bundle bundle=new Bundle();
                bundle.putInt("tishu", Integer.valueOf(edtishu.getText().toString()));
                intent.putExtras(bundle);
                startActivity(intent);
                finish();
            }
        });
        
        
        zhongbtn.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
            
                Intent intent=new Intent(TixingActivity.this,ZhongjiMainActivity.class);
                Bundle bundle=new Bundle();
                bundle.putInt("tishu", Integer.valueOf(edtishu.getText().toString()));
                intent.putExtras(bundle);
                startActivity(intent);
                finish();
            }
        });
        
        gaobtn.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent=new Intent(TixingActivity.this,TGaojiActivity.class);
                Bundle bundle=new Bundle();
                bundle.putInt("tishu", Integer.valueOf(edtishu.getText().toString()));
                intent.putExtras(bundle);
                startActivity(intent);
                finish();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.tixing, menu);
        return true;
    }

}
TixingActivity
package com.de.sizhe;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.app.Activity;
import android.content.Intent;

public class ChujiActivity extends Activity {

    private TableLayout tableLayout;
    private TextView tv1;
    private Button b1;
    private int count=0;
    private int t=0;
    static DecimalFormat decimal = new DecimalFormat("#.##");
    
    private Handler handler=new Handler();
    private Runnable runnable=new Runnable() {
        
        @Override
        public void run() {
            // TODO Auto-generated method stub
            ++t;
            tv1.setText("时间:"+String.valueOf(t));
            handler.postDelayed(runnable, 1000);
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tgaoji);
        handler.postDelayed(runnable, 1000);
        
        final Intent intent1=new Intent(ChujiActivity.this,TDeFenActivity.class);
        tableLayout=(TableLayout) findViewById(R.id.GTab);
        b1=(Button) findViewById(R.id.b1);
        tv1=(TextView) findViewById(R.id.shijian);
        
        Intent intent=getIntent();
        Bundle bundle=intent.getExtras();
        count=bundle.getInt("tishu");//获取题目数量        
        
        String str1 = new String();    //题目
        final String s[] = new String[count]; //题目数组
        final String[] str=new String[count];  //用户输入的答案数组
        final String[] bjanswer = new String[count];// 标准答案
        int[] num1 = new int[4];   //计算的各个数值

        final EditText[] answer=new EditText[count];
        TextView[] show=new TextView[count];

        for(int i=0;i<count;i++)
        {
            int n=2;//4个操作数
            char[] op = { '+', '-', '*', '/' };
            int[] no = new int[4];
            int cs;// 正负参数

            TableRow tableRow=new TableRow(this);
            show[i]=new TextView(this);
            answer[i]=new EditText(this);

            tableRow.addView(show[i]);
            tableRow.addView(answer[i]);

            for (int j = 0; j < n; j++) 
            {
                cs = (int) (Math.random() * 2);
                if (cs == 0)// 负数
                    num1[j] = -(int) (Math.random() * 100);// 控制随机数数值
                else// 正数
                    num1[j] = (int) (Math.random() * 100);// 控制随机数数值
            }

            for (int k = 0; k < n - 1; k++) 
            {
                no[k] = (int) (Math.random() * 4);// 随机产生操作符
                if (no[k] == 3 && num1[k + 1] == 0) 
                {
                    do {
                        num1[k + 1] = (int) (Math.random() * 100);// 如果除号后为0,则重新取数。
                        } while (num1[k + 1] == 0);
                }
            }
            
            for (int h = 0; h < n; h++) 
            {
                if (h != n - 1)
                {
                    if (num1[h] < 0)
                        str1 = str1 +"  (" + String.valueOf(num1[h])+")" + String.valueOf(op[no[h]]);
                    else
                        str1 = str1 +"  "+ String.valueOf(num1[h])+ String.valueOf(op[no[h]]);
                } 
                else
                {
                    if (num1[h] < 0)
                        str1 = str1 +"  (" + String.valueOf(num1[h]) +")=";
                    else
                        str1 = str1+"  " + String.valueOf(num1[h]) + "=";
                }
            }
            s[i] = str1;
            str1 = new String();

            
            
            // 计算标准答案
            int sign; // 累加运算时的符号
            float left, right;// 保存蹭结果
            decimal.setRoundingMode(RoundingMode.HALF_UP);
            left = 0;
            right = num1[0];
            sign = 1;

            for (int g = 0; g < n - 1; g++)
            {
                switch (op[no[g]])
                {
                case '+':
                    left = left + sign * right;
                    sign = 1;
                    right = num1[g + 1];
                    break;
                case '-':
                    left = left + sign * right;
                    sign = -1;
                    right = num1[g + 1];
                    break;
                case '*':
                    right = right * num1[g + 1];
                    break;
                case '/':
                    right = right / num1[g + 1];
                    break;
                }
            }
            bjanswer[i] = String.valueOf(decimal.format(left + sign * right));

            show[i].setText(s[i]);
            show[i].setTextSize(18);
            answer[i].setEms(5);
            answer[i].setId(i);
            tableLayout.addView(tableRow);
        }
        b1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                for(int i=0;i<count;i++)
                {
                    str[i]=answer[i].getText().toString();        //用户输入的答案数组            
                }
                Bundle bundle=new Bundle();
                bundle.putStringArray("timu", s);
                bundle.putStringArray("useranswer", str);
                bundle.putStringArray("bjanswer", bjanswer);
                bundle.putInt("Ttishu", count);
                bundle.putString("shijian", String.valueOf(t));
                intent1.putExtras(bundle);
                startActivity(intent1);                
                handler.removeCallbacks(runnable);
                finish();
            }
        });
    }


}
ChujiActivity
package com.de.sizhe;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.app.Activity;
import android.content.Intent;

public class ZhongjiMainActivity extends Activity {

    private TableLayout tableLayout;
    private TextView tv1;
    private Button b1;
    private int count=0;
    private int t=0;
    static DecimalFormat decimal = new DecimalFormat("#.##");
    
    private Handler handler=new Handler();
    private Runnable runnable=new Runnable() {
        
        @Override
        public void run() {
            // TODO Auto-generated method stub
            ++t;
            tv1.setText("时间:"+String.valueOf(t));
            handler.postDelayed(runnable, 1000);
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tgaoji);
        handler.postDelayed(runnable, 1000);
        
        final Intent intent1=new Intent(ZhongjiMainActivity.this,TDeFenActivity.class);
        tableLayout=(TableLayout) findViewById(R.id.GTab);
        b1=(Button) findViewById(R.id.b1);
        tv1=(TextView) findViewById(R.id.shijian);
        
        Intent intent=getIntent();
        Bundle bundle=intent.getExtras();
        count=bundle.getInt("tishu");//获取题目数量        
        
        String str1 = new String();    //题目
        final String s[] = new String[count]; //题目数组
        final String[] str=new String[count];  //用户输入的答案数组
        final String[] bjanswer = new String[count];// 标准答案
        int[] num1 = new int[4];   //计算的各个数值

        final EditText[] answer=new EditText[count];
        TextView[] show=new TextView[count];

        for(int i=0;i<count;i++)
        {
            int n=3;//3个操作数
            char[] op = { '+', '-', '*', '/' };
            int[] no = new int[4];
            int cs;// 正负参数

            TableRow tableRow=new TableRow(this);
            show[i]=new TextView(this);
            answer[i]=new EditText(this);

            tableRow.addView(show[i]);
            tableRow.addView(answer[i]);

            for (int j = 0; j < n; j++) 
            {
                cs = (int) (Math.random() * 2);
                if (cs == 0)// 负数
                    num1[j] = -(int) (Math.random() * 100);// 控制随机数数值
                else// 正数
                    num1[j] = (int) (Math.random() * 100);// 控制随机数数值
            }

            for (int k = 0; k < n - 1; k++) 
            {
                no[k] = (int) (Math.random() * 4);// 随机产生操作符
                if (no[k] == 3 && num1[k + 1] == 0) 
                {
                    do {
                        num1[k + 1] = (int) (Math.random() * 100);// 如果除号后为0,则重新取数。
                        } while (num1[k + 1] == 0);
                }
            }
            
            for (int h = 0; h < n; h++) 
            {
                if (h != n - 1)
                {
                    if (num1[h] < 0)
                        str1 = str1 + "   (" + String.valueOf(num1[h]) + ")"+ String.valueOf(op[no[h]]);
                    else
                        str1 = str1 + "   "+String.valueOf(num1[h])+ String.valueOf(op[no[h]]);
                } 
                else
                {
                    if (num1[h] < 0)
                        str1 = str1 + "   (" + String.valueOf(num1[h]) + ")=";
                    else
                        str1 = str1 + "   "+String.valueOf(num1[h]) + "=";
                }
            }
            s[i] = str1;
            str1 = new String();

            
            
            // 计算标准答案
            int sign; // 累加运算时的符号
            float left, right;// 保存蹭结果
            decimal.setRoundingMode(RoundingMode.HALF_UP);
            left = 0;
            right = num1[0];
            sign = 1;

            for (int g = 0; g < n - 1; g++)
            {
                switch (op[no[g]])
                {
                case '+':
                    left = left + sign * right;
                    sign = 1;
                    right = num1[g + 1];
                    break;
                case '-':
                    left = left + sign * right;
                    sign = -1;
                    right = num1[g + 1];
                    break;
                case '*':
                    right = right * num1[g + 1];
                    break;
                case '/':
                    right = right / num1[g + 1];
                    break;
                }
            }
            bjanswer[i] = String.valueOf(decimal.format(left + sign * right));

            show[i].setText(s[i]);
            show[i].setTextSize(18);
            answer[i].setEms(5);
            answer[i].setId(i);
            tableLayout.addView(tableRow);
        }
        b1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                for(int i=0;i<count;i++)
                {
                    str[i]=answer[i].getText().toString();        //用户输入的答案数组            
                }
                Bundle bundle=new Bundle();
                bundle.putStringArray("timu", s);
                bundle.putStringArray("useranswer", str);
                bundle.putStringArray("bjanswer", bjanswer);
                bundle.putInt("Ttishu", count);
                bundle.putString("shijian", String.valueOf(t));
                intent1.putExtras(bundle);
                startActivity(intent1);                
                handler.removeCallbacks(runnable);
                finish();
            }
        });
    }


}
ZhongjiMainActivity
package com.de.sizhe;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.app.Activity;
import android.content.Intent;

public class TGaojiActivity extends Activity {

    private TableLayout tableLayout;
    private TextView tv1;
    private Button b1;
    private int count=0;
    private int t=0;
    static DecimalFormat decimal = new DecimalFormat("#.##");
    
    private Handler handler=new Handler();
    private Runnable runnable=new Runnable() {
        
        @Override
        public void run() {
            // TODO Auto-generated method stub
            ++t;
            tv1.setText("时间:"+String.valueOf(t));
            handler.postDelayed(runnable, 1000);
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tgaoji);
        handler.postDelayed(runnable, 1000);
        
        final Intent intent1=new Intent(TGaojiActivity.this,TDeFenActivity.class);
        tableLayout=(TableLayout) findViewById(R.id.GTab);
        b1=(Button) findViewById(R.id.b1);
        tv1=(TextView) findViewById(R.id.shijian);
        
        Intent intent=getIntent();
        Bundle bundle=intent.getExtras();
        count=bundle.getInt("tishu");//获取题目数量        
        
        String str1 = new String();    //题目
        final String s[] = new String[count]; //题目数组
        final String[] str=new String[count];  //用户输入的答案数组
        final String[] bjanswer = new String[count];// 标准答案
        int[] num1 = new int[4];   //计算的各个数值

        final EditText[] answer=new EditText[count];
        TextView[] show=new TextView[count];

        for(int i=0;i<count;i++)
        {
            int n=4;//4个操作数
            char[] op = { '+', '-', '*', '/' };
            int[] no = new int[4];
            int cs;// 正负参数

            TableRow tableRow=new TableRow(this);
            show[i]=new TextView(this);
            answer[i]=new EditText(this);

            tableRow.addView(show[i]);
            tableRow.addView(answer[i]);

            for (int j = 0; j < n; j++) 
            {
                cs = (int) (Math.random() * 2);
                if (cs == 0)// 负数
                    num1[j] = -(int) (Math.random() * 100);// 控制随机数数值
                else// 正数
                    num1[j] = (int) (Math.random() * 100);// 控制随机数数值
            }

            for (int k = 0; k < n - 1; k++) 
            {
                no[k] = (int) (Math.random() * 4);// 随机产生操作符
                if (no[k] == 3 && num1[k + 1] == 0) 
                {
                    do {
                        num1[k + 1] = (int) (Math.random() * 100);// 如果除号后为0,则重新取数。
                        } while (num1[k + 1] == 0);
                }
            }
            
            for (int h = 0; h < n; h++) 
            {
                if (h != n - 1)
                {
                    if (num1[h] < 0)
                        str1 = str1 + "(" + String.valueOf(num1[h]) + ")"+ String.valueOf(op[no[h]]);
                    else
                        str1 = str1 + String.valueOf(num1[h])+ String.valueOf(op[no[h]]);
                } 
                else
                {
                    if (num1[h] < 0)
                        str1 = str1 + "(" + String.valueOf(num1[h]) + ")=";
                    else
                        str1 = str1 + String.valueOf(num1[h]) + "=";
                }
            }
            s[i] = str1;
            str1 = new String();

            
            
            // 计算标准答案
            int sign; // 累加运算时的符号
            float left, right;// 保存蹭结果
            decimal.setRoundingMode(RoundingMode.HALF_UP);
            left = 0;
            right = num1[0];
            sign = 1;

            for (int g = 0; g < n - 1; g++)
            {
                switch (op[no[g]])
                {
                case '+':
                    left = left + sign * right;
                    sign = 1;
                    right = num1[g + 1];
                    break;
                case '-':
                    left = left + sign * right;
                    sign = -1;
                    right = num1[g + 1];
                    break;
                case '*':
                    right = right * num1[g + 1];
                    break;
                case '/':
                    right = right / num1[g + 1];
                    break;
                }
            }
            bjanswer[i] = String.valueOf(decimal.format(left + sign * right));

            show[i].setText(s[i]);
            show[i].setTextSize(18);
            answer[i].setEms(5);
            answer[i].setId(i);
            tableLayout.addView(tableRow);
        }
        b1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                for(int i=0;i<count;i++)
                {
                    str[i]=answer[i].getText().toString();        //用户输入的答案数组            
                }
                Bundle bundle=new Bundle();
                bundle.putStringArray("timu", s);
                bundle.putStringArray("useranswer", str);
                bundle.putStringArray("bjanswer", bjanswer);
                bundle.putInt("Ttishu", count);
                bundle.putString("shijian", String.valueOf(t));
                intent1.putExtras(bundle);
                startActivity(intent1);                
                handler.removeCallbacks(runnable);
                finish();
            }
        });
    }


}
TGaojiActivity
package com.de.sizhe;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class TDeFenActivity extends Activity {

    private Button cxbtn,tcbtn;
    private TableLayout dtab1;
    private TextView textView;
    private int count=0;
    private String sj=null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tde_fen);        
        dtab1=(TableLayout) findViewById(R.id.DTab1);
        cxbtn=(Button) findViewById(R.id.chongxin);
        tcbtn=(Button) findViewById(R.id.tuichu);
        textView=(TextView) findViewById(R.id.showtime);
        
        Intent intent=getIntent();
        Bundle bundle=intent.getExtras();
        count=bundle.getInt("Ttishu");
        
        String[] sty=new String[count];
        String[] stb=new String[count];
        String[] stimu=new String[count];
        
        sty=bundle.getStringArray("useranswer");
        stb=bundle.getStringArray("bjanswer");
        sj=bundle.getString("shijian");
        stimu=bundle.getStringArray("timu");
        
        
        textView.setText("完成时间为:"+sj+"s");
        int tn=(count+1)*3;
        TextView[] Tshow=new TextView[tn];
        
        TableRow tableRow=new TableRow(this);
        Tshow[0]=new TextView(this);
        Tshow[1]=new TextView(this);
        Tshow[2]=new TextView(this);
        Tshow[0].setText("                   题目");
        Tshow[1].setText("      你的答案");
        Tshow[2].setText("      正确答案");
        tableRow.addView(Tshow[0]);
        tableRow.addView(Tshow[1]);
        tableRow.addView(Tshow[2]);
        dtab1.addView(tableRow);
        for(int i=0;i<count;i++)
        {
            TableRow tableRow1=new TableRow(this);
            Tshow[(i+1)*3]=new TextView(this);
            Tshow[(i+1)*3+1]=new TextView(this);
            Tshow[(i+1)*3+2]=new TextView(this);
            tableRow1.addView(Tshow[(i+1)*3]);
            tableRow1.addView(Tshow[(i+1)*3+1]);
            tableRow1.addView(Tshow[(i+1)*3+2]);
            
            Tshow[(i+1)*3].setText(stimu[i]);
            Tshow[(i+1)*3+1].setText(sty[i]);
            Tshow[(i+1)*3+1].setGravity(Gravity.RIGHT);
            Tshow[(i+1)*3+2].setText(stb[i]);
            Tshow[(i+1)*3+2].setGravity(Gravity.RIGHT);
            dtab1.addView(tableRow1);
        }
        
        cxbtn.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent=new Intent(TDeFenActivity.this,TixingActivity.class);
                startActivity(intent);
                finish();
            }
        });
        
        tcbtn.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                finish();
            }
        });
        
    }

}
TDeFenActivity

layout部分:

<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:background="@drawable/tupian2"
    tools:context=".MainActivity" >
    
    <TextView
        android:id="@+id/huanying"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="74dp"
        android:text="@string/huanying" />

    <Button
        android:id="@+id/jinru"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/jinru" />

</RelativeLayout>
activity_mian.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:background="@drawable/tupian3"
    tools:context=".TGaojiActivity" >

    <TextView
        android:id="@+id/shijian"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" />

    <TableLayout
        android:id="@+id/GTab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="30dp"
        android:baselineAligned="false">
    </TableLayout>

    <Button
        android:id="@+id/b1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:text="@string/tijiao" />

</RelativeLayout>
activity_chuji.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:background="@drawable/bg5"
    tools:context=".TixingActivity" >


    <Button
        android:id="@+id/chuji"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="118dp"
        android:text="@string/chuji" />

    <Button
        android:id="@+id/zhongji"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/chuji"
        android:layout_below="@+id/chuji"
        android:layout_marginTop="19dp"
        android:text="@string/zhongji" />

    <Button
        android:id="@+id/gaoji"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/zhongji"
        android:layout_below="@+id/zhongji"
        android:layout_marginTop="19dp"
        android:text="@string/gaoji" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="8dp"
        android:gravity="center_horizontal" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/tishu" />

        <EditText
            android:id="@+id/tishu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="3"
            android:inputType="number" >

            <requestFocus />
        </EditText>

    </LinearLayout>

</RelativeLayout>
activity_tixing.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:background="@drawable/tupian3"
    tools:context=".TGaojiActivity" >

    <TextView
        android:id="@+id/shijian"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" />

    <TableLayout
        android:id="@+id/GTab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="30dp"
        android:baselineAligned="false">
    </TableLayout>

    <Button
        android:id="@+id/b1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:text="@string/tijiao" />

</RelativeLayout>
activity_zhongji.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:background="@drawable/tupian2"
    tools:context=".TGaojiActivity" >

    <TextView
        android:id="@+id/shijian"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" />

    <TableLayout
        android:id="@+id/GTab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="30dp"
        android:baselineAligned="false">
    </TableLayout>

    <Button
        android:id="@+id/b1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:text="@string/tijiao" />

</RelativeLayout>
activity_tgao.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:background="@drawable/tupian2"
    tools:context=".TDeFenActivity" >

    <TableLayout
        android:id="@+id/DTab1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="30dp"
        android:baselineAligned="false" >
    </TableLayout>

    <TextView
        android:id="@+id/showtime"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/DTab1"
        android:layout_marginTop="15dp" />

    <Button
        android:id="@+id/chongxin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="46dp"
        android:text="@string/chongxin" />

    <Button
        android:id="@+id/tuichu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="46dp"
        android:text="@string/tuichu" />

</RelativeLayout>
activity_tde_fen.xml

 

app在手机上的运行截图

      

   

这个四则运算app基本上是做出了轮廓来,虽然还有很多不足的地方,但我门会努力改进,以下附上燃尽图:

 

posted @ 2015-11-27 20:47  38郑胜斌  阅读(179)  评论(1编辑  收藏  举报