经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 移动开发 » Android » 查看文章
Android?Studio实现简易计算器设计
来源:jb51  时间:2022/5/18 8:43:04  对本文有异议

本文实例为大家分享了Android Studio实现简易计算器的具体代码,供大家参考,具体内容如下

一、题目

1、如图所示(实际设计,类似此界面样式即可,全屏时,按钮将会纵向拉伸),利用网格布局管理器设计一个居中、满屏计算器,项目名称:clc666b;(666,改成自己的实际编号)

2、加、乘分别用2个单选按钮进行选择;

3、为clc666b编写程序(clc666a不需要编程,只设计界面即可),根据选择的加(乘)单选按钮,实现两个数的加法和乘法的简单计算。

4、为了简化程序设计,上方的数据区也可以设计成3个文本框(如果一个文本框实现功能,则更好),分别用作被(乘)加数、加(乘)数、合(积);

二、分析

1.首要的目标是先做一个窗口,窗口设计需要滿屏平分,所以要修改每一个部件的权重。

2.java程序设计,要监听不同种类的按键,网上基本上都是普通按键的程序,没有radiobutton的,这个题目对于我这种新手来说有点不太友好,不能直接抄网上的,还要根据老师上课讲的改一改。

(1)当按下数字按键时,把按键所对应的数字存到一个字符串中,然后更新text。

(2)如果按下删除的时候把字符串最后一个字符删去即可,然后更新text.。

(3)当按下运算符号键时,把前面的字符存在一个字符串a中,并保存运算符号键的id地址。

(4)继续进行前两步的操作,直到按下等于号键运行(5)。

(5)把运算符号后的给字符串b,根据id来对a和b进行运算,更新text。

三、代码

1.更新后的xml代码

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. ? ? xmlns:app="http://schemas.android.com/apk/res-auto"
  4. ? ? xmlns:tools="http://schemas.android.com/tools"
  5. ? ? android:layout_width="match_parent"
  6. ? ? android:layout_height="match_parent"
  7. ? ? android:layout_row="6"
  8. ? ? android:layout_column="3"
  9. ? ? android:background="#FF0097A7"
  10. ? ? tools:context=".MainActivity">
  11. ?
  12. ? ? <TextView
  13. ? ? ? ? android:id="@+id/textview1"
  14. ? ? ? ? android:layout_width="0dp"
  15. ? ? ? ? android:layout_height="0dp"
  16. ? ? ? ? android:layout_rowSpan="1"
  17. ? ? ? ? android:layout_rowWeight="2"
  18. ? ? ? ? android:layout_columnSpan="3"
  19. ? ? ? ? android:layout_columnWeight="3"
  20. ? ? ? ? android:background="#F1D5A2"
  21. ? ? ? ? android:text=" "
  22. ? ? ? ? android:textSize="30sp" />
  23. ?
  24. ? ? <Button
  25. ? ? ? ? android:id="@+id/nm1"
  26. ? ? ? ? android:layout_width="0dp"
  27. ? ? ? ? android:layout_height="0dp"
  28. ? ? ? ? android:layout_row="3"
  29. ? ? ? ? android:layout_rowSpan="1"
  30. ? ? ? ? android:layout_rowWeight="1"
  31. ? ? ? ? android:layout_column="0"
  32. ? ? ? ? android:layout_columnSpan="1"
  33. ? ? ? ? android:layout_columnWeight="1"
  34. ? ? ? ? android:text="1"
  35. ? ? ? ? android:textSize="36sp" />
  36. ?
  37. ? ? <Button
  38. ? ? ? ? android:id="@+id/nm2"
  39. ? ? ? ? android:layout_width="0dp"
  40. ? ? ? ? android:layout_height="0dp"
  41. ? ? ? ? android:layout_rowSpan="1"
  42. ? ? ? ? android:layout_rowWeight="1"
  43. ? ? ? ? android:layout_columnSpan="1"
  44. ? ? ? ? android:layout_columnWeight="1"
  45. ? ? ? ? android:text="2"
  46. ? ? ? ? android:textSize="36sp" />
  47. ?
  48. ? ? <RadioGroup
  49. ? ? ? ? android:id="@+id/radioGroup2"
  50. ? ? ? ? android:layout_width="wrap_content"
  51. ? ? ? ? android:layout_height="wrap_content"
  52. ? ? ? ? android:layout_rowSpan="2"
  53. ? ? ? ? android:layout_rowWeight="1"
  54. ? ? ? ? android:layout_columnSpan="1"
  55. ? ? ? ? android:layout_columnWeight="1"
  56. ? ? ? ? android:layout_gravity="center">
  57. ?
  58. ? ? ? ? <RadioButton
  59. ? ? ? ? ? ? android:id="@+id/mul"
  60. ? ? ? ? ? ? android:layout_width="wrap_content"
  61. ? ? ? ? ? ? android:layout_height="wrap_content"
  62. ? ? ? ? ? ? android:layout_rowWeight="1"
  63. ? ? ? ? ? ? android:layout_columnWeight="1"
  64. ? ? ? ? ? ? android:checked="false"
  65. ? ? ? ? ? ? android:text="×"
  66. ? ? ? ? ? ? android:textSize="36sp" />
  67. ?
  68. ? ? ? ? <RadioButton
  69. ? ? ? ? ? ? android:id="@+id/add"
  70. ? ? ? ? ? ? android:layout_width="wrap_content"
  71. ? ? ? ? ? ? android:layout_height="wrap_content"
  72. ? ? ? ? ? ? android:layout_rowWeight="1"
  73. ? ? ? ? ? ? android:layout_columnWeight="1"
  74. ? ? ? ? ? ? android:checked="false"
  75. ? ? ? ? ? ? android:text="+"
  76. ? ? ? ? ? ? android:textSize="36sp" />
  77. ?
  78. ? ? </RadioGroup>
  79. ?
  80. ? ? <Button
  81. ? ? ? ? android:id="@+id/nm3"
  82. ? ? ? ? android:layout_width="0dp"
  83. ? ? ? ? android:layout_height="0dp"
  84. ? ? ? ? android:layout_row="4"
  85. ? ? ? ? android:layout_rowSpan="1"
  86. ? ? ? ? android:layout_rowWeight="1"
  87. ? ? ? ? android:layout_column="0"
  88. ? ? ? ? android:layout_columnSpan="1"
  89. ? ? ? ? android:layout_columnWeight="1"
  90. ? ? ? ? android:text="3"
  91. ? ? ? ? android:textSize="36sp" />
  92. ?
  93. ? ? <Button
  94. ? ? ? ? android:id="@+id/del"
  95. ? ? ? ? android:layout_width="0dp"
  96. ? ? ? ? android:layout_height="0dp"
  97. ? ? ? ? android:layout_rowSpan="1"
  98. ? ? ? ? android:layout_rowWeight="1"
  99. ? ? ? ? android:layout_columnSpan="1"
  100. ? ? ? ? android:layout_columnWeight="1"
  101. ? ? ? ? android:text="DEL"
  102. ? ? ? ? android:textSize="36sp" />
  103. ?
  104. ? ? <Button
  105. ? ? ? ? android:id="@+id/equ"
  106. ? ? ? ? android:layout_width="0dp"
  107. ? ? ? ? android:layout_height="0dp"
  108. ? ? ? ? android:layout_row="5"
  109. ? ? ? ? android:layout_rowSpan="1"
  110. ? ? ? ? android:layout_rowWeight="1"
  111. ? ? ? ? android:layout_column="0"
  112. ? ? ? ? android:layout_columnSpan="2"
  113. ? ? ? ? android:layout_columnWeight="1"
  114. ? ? ? ? android:text="="
  115. ? ? ? ? android:textSize="36sp" />
  116. ?
  117. </GridLayout>

2.更新后的java代码

  1. package com.example.lenovo.clc231b;
  2. ?
  3. import androidx.appcompat.app.AppCompatActivity;
  4. ?
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.view.View.OnClickListener;
  9. import android.widget.TextView;
  10. ?
  11. public class MainActivity extends AppCompatActivity {
  12. ?
  13. ? ? private String num = "";
  14. ? ? private String num_zong = "";
  15. ? ? private int fore,back,lenth,id;
  16. ? ? TextView textview1;
  17. ? ? Button nm1;
  18. ? ? Button nm2;
  19. ? ? Button nm3;
  20. ? ? Button del;
  21. ? ? Button equ;
  22. ? ? Button mul;
  23. ? ? Button add;
  24. ?
  25. ? ? @Override
  26. ? ? public void onCreate(Bundle savedInstanceState) {
  27. ? ? ? ? super.onCreate(savedInstanceState);
  28. ? ? ? ? setContentView(R.layout.activity_main);
  29. ?
  30. ? ? ? ? textview1=(TextView)findViewById(R.id.textview1);
  31. ?
  32. ? ? ? ? nm1 = (Button)findViewById(R.id.nm1);
  33. ? ? ? ? nm2 = (Button)findViewById(R.id.nm2);
  34. ? ? ? ? nm3 = (Button)findViewById(R.id.nm3);
  35. ? ? ? ? del = (Button)findViewById(R.id.del);
  36. ? ? ? ? equ = (Button)findViewById(R.id.equ);
  37. ? ? ? ? mul = (Button)findViewById(R.id.mul);
  38. ? ? ? ? add = (Button)findViewById(R.id.add);
  39. ?
  40. ? ? ? ? nm1.setOnClickListener(listener);
  41. ? ? ? ? nm2.setOnClickListener(listener);
  42. ? ? ? ? nm3.setOnClickListener(listener);
  43. ? ? ? ? del.setOnClickListener(listener);
  44. ? ? ? ? equ.setOnClickListener(listener);
  45. ? ? ? ? mul.setOnClickListener(listener);
  46. ? ? ? ? add.setOnClickListener(listener);
  47. ?
  48. ? ? }
  49. ? ? //监听按钮
  50. ? ? public OnClickListener listener = new OnClickListener() {
  51. ? ? ? ? @Override
  52. ? ? ? ? public void onClick(View view) {
  53. ? ? ? ? ? ? switch (view.getId()){
  54. ? ? ? ? ? ? ? ? case R.id.nm1:
  55. ? ? ? ? ? ? ? ? ? ? number(1);
  56. ? ? ? ? ? ? ? ? ? ? break;
  57. ? ? ? ? ? ? ? ? case R.id.nm2:
  58. ? ? ? ? ? ? ? ? ? ? number(2);
  59. ? ? ? ? ? ? ? ? ? ? break;
  60. ? ? ? ? ? ? ? ? case R.id.nm3:
  61. ? ? ? ? ? ? ? ? ? ? number(3);
  62. ? ? ? ? ? ? ? ? ? ? break;
  63. ? ? ? ? ? ? ? ? case R.id.del:
  64. ? ? ? ? ? ? ? ? ? ? delete();
  65. ? ? ? ? ? ? ? ? ? ? break;
  66. ? ? ? ? ? ? ? ? case R.id.equ:
  67. ? ? ? ? ? ? ? ? ? ? result();
  68. ? ? ? ? ? ? ? ? ? ? break;
  69. ? ? ? ? ? ? ? ? case R.id.mul:
  70. ? ? ? ? ? ? ? ? ? ? Get_mul_add(1);
  71. ? ? ? ? ? ? ? ? ? ? break;
  72. ? ? ? ? ? ? ? ? case R.id.add:
  73. ? ? ? ? ? ? ? ? ? ? Get_mul_add(2);
  74. ? ? ? ? ? ? ? ? ? ? break;
  75. ? ? ? ? ? ? ? ? default:
  76. ? ? ? ? ? ? ? ? ? ? break;
  77. ? ? ? ? ? ? }
  78. ? ? ? ? ? ? textview1.setText(num);
  79. ? ? ? ? }
  80. ? ? };
  81. ?
  82. ? ? private void Get_mul_add(int flag){
  83. ? ? ? ? fore = Integer.valueOf(num);
  84. ? ? ? ? if(flag == 1) {
  85. ? ? ? ? ? ? id = R.id.mul;
  86. ? ? ? ? ? ? num += "×";
  87. ? ? ? ? }
  88. ? ? ? ? else {
  89. ? ? ? ? ? ? id = R.id.add;
  90. ? ? ? ? ? ? num += "+";
  91. ? ? ? ? }
  92. ? ? ? ? textview1.setText(num);
  93. ? ? ? ? lenth = num.length();
  94. ? ? }
  95. ?
  96. ? ? private void result() {
  97. ? ? ? ? num_zong = num;
  98. ? ? ? ? num = num.substring(lenth);
  99. ? ? ? ? back = Integer.valueOf(num);
  100. ? ? ? ? if(id == R.id.mul)
  101. ? ? ? ? ? ? num = String.valueOf((fore*back));
  102. ? ? ? ? else
  103. ? ? ? ? ? ? num = String.valueOf((fore+back));
  104. ? ? ? ? num = num_zong + "=" + num;
  105. ? ? }
  106. ?
  107. ? ? private void delete() {
  108. ? ? ? ? num = num.substring(0,num.length()-1);
  109. ? ? }
  110. ?
  111. ? ? private void number(int i) {
  112. ? ? ? ? num += i;
  113. ? ? }
  114. }

3.原来的代码

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. ? ? xmlns:app="http://schemas.android.com/apk/res-auto"
  4. ? ? xmlns:tools="http://schemas.android.com/tools"
  5. ? ? android:layout_width="match_parent"
  6. ? ? android:layout_height="match_parent"
  7. ? ? android:layout_row="6"
  8. ? ? android:layout_column="3"
  9. ? ? android:background="#FF0097A7"
  10. ? ? tools:context=".MainActivity">
  11. ?
  12. ? ? <TextView
  13. ? ? ? ? android:id="@+id/textview1"
  14. ? ? ? ? android:layout_width="0dp"
  15. ? ? ? ? android:layout_height="0dp"
  16. ? ? ? ? android:layout_rowSpan="1"
  17. ? ? ? ? android:layout_rowWeight="3"
  18. ? ? ? ? android:layout_columnSpan="3"
  19. ? ? ? ? android:layout_columnWeight="3"
  20. ? ? ? ? android:background="#F1D5A2"
  21. ? ? ? ? android:text=" "
  22. ? ? ? ? android:textSize="30sp" />
  23. ?
  24. ? ? <Button
  25. ? ? ? ? android:id="@+id/button1"
  26. ? ? ? ? android:layout_width="0dp"
  27. ? ? ? ? android:layout_height="0dp"
  28. ? ? ? ? android:layout_row="3"
  29. ? ? ? ? android:layout_rowSpan="1"
  30. ? ? ? ? android:layout_rowWeight="1"
  31. ? ? ? ? android:layout_column="0"
  32. ? ? ? ? android:layout_columnSpan="1"
  33. ? ? ? ? android:layout_columnWeight="1"
  34. ? ? ? ? android:text="1"
  35. ? ? ? ? android:textSize="36sp" />
  36. ?
  37. ? ? <Button
  38. ? ? ? ? android:id="@+id/button2"
  39. ? ? ? ? android:layout_width="0dp"
  40. ? ? ? ? android:layout_height="0dp"
  41. ? ? ? ? android:layout_rowSpan="1"
  42. ? ? ? ? android:layout_rowWeight="1"
  43. ? ? ? ? android:layout_columnSpan="1"
  44. ? ? ? ? android:layout_columnWeight="1"
  45. ? ? ? ? android:text="2"
  46. ? ? ? ? android:textSize="36sp" />
  47. ?
  48. ? ? <RadioGroup
  49. ? ? ? ? android:id="@+id/radioGroup2"
  50. ? ? ? ? android:layout_width="wrap_content"
  51. ? ? ? ? android:layout_height="wrap_content"
  52. ? ? ? ? android:layout_rowSpan="2"
  53. ? ? ? ? android:layout_rowWeight="1"
  54. ? ? ? ? android:layout_columnSpan="1"
  55. ? ? ? ? android:layout_columnWeight="1"
  56. ? ? ? ? android:layout_gravity="center">
  57. ?
  58. ? ? ? ? <RadioButton
  59. ? ? ? ? ? ? android:id="@+id/r1"
  60. ? ? ? ? ? ? android:layout_width="wrap_content"
  61. ? ? ? ? ? ? android:layout_height="wrap_content"
  62. ? ? ? ? ? ? android:layout_rowWeight="1"
  63. ? ? ? ? ? ? android:layout_columnWeight="1"
  64. ? ? ? ? ? ? android:checked="false"
  65. ? ? ? ? ? ? android:text="×"
  66. ? ? ? ? ? ? android:textSize="36sp" />
  67. ?
  68. ? ? ? ? <RadioButton
  69. ? ? ? ? ? ? android:id="@+id/r2"
  70. ? ? ? ? ? ? android:layout_width="wrap_content"
  71. ? ? ? ? ? ? android:layout_height="wrap_content"
  72. ? ? ? ? ? ? android:layout_rowWeight="1"
  73. ? ? ? ? ? ? android:layout_columnWeight="1"
  74. ? ? ? ? ? ? android:checked="false"
  75. ? ? ? ? ? ? android:text="+"
  76. ? ? ? ? ? ? android:textSize="36sp" />
  77. ? ? </RadioGroup>
  78. ?
  79. ? ? <Button
  80. ? ? ? ? android:id="@+id/button3"
  81. ? ? ? ? android:layout_width="0dp"
  82. ? ? ? ? android:layout_height="0dp"
  83. ? ? ? ? android:layout_row="4"
  84. ? ? ? ? android:layout_rowSpan="1"
  85. ? ? ? ? android:layout_rowWeight="1"
  86. ? ? ? ? android:layout_column="0"
  87. ? ? ? ? android:layout_columnSpan="1"
  88. ? ? ? ? android:layout_columnWeight="1"
  89. ? ? ? ? android:text="3"
  90. ? ? ? ? android:textSize="36sp" />
  91. ?
  92. ? ? <Button
  93. ? ? ? ? android:id="@+id/button4"
  94. ? ? ? ? android:layout_width="0dp"
  95. ? ? ? ? android:layout_height="0dp"
  96. ? ? ? ? android:layout_rowSpan="1"
  97. ? ? ? ? android:layout_rowWeight="1"
  98. ? ? ? ? android:layout_columnSpan="1"
  99. ? ? ? ? android:layout_columnWeight="1"
  100. ? ? ? ? android:text="DEL"
  101. ? ? ? ? android:textSize="36sp" />
  102. ?
  103. ? ? <Button
  104. ? ? ? ? android:id="@+id/button5"
  105. ? ? ? ? android:layout_width="0dp"
  106. ? ? ? ? android:layout_height="0dp"
  107. ? ? ? ? android:layout_row="5"
  108. ? ? ? ? android:layout_rowSpan="1"
  109. ? ? ? ? android:layout_rowWeight="1"
  110. ? ? ? ? android:layout_column="0"
  111. ? ? ? ? android:layout_columnSpan="2"
  112. ? ? ? ? android:layout_columnWeight="1"
  113. ? ? ? ? android:text="="
  114. ? ? ? ? android:textSize="36sp" />
  115. ?
  116. </GridLayout>
  1. package com.example.lenovo.clc231b;
  2. ?
  3. import androidx.appcompat.app.AppCompatActivity;
  4. ?
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.view.View.OnClickListener;
  9. import android.widget.RadioButton;
  10. import android.widget.RadioGroup;
  11. import android.widget.TextView;
  12. ?
  13. public class MainActivity extends AppCompatActivity {
  14. ?
  15. ? ? private String num = "";
  16. ? ? private String num_zong = "";
  17. ? ? private int fore,back,lenth,id;
  18. ? ? TextView textview1;
  19. ? ? RadioGroup question2;
  20. ? ? Button button1;
  21. ? ? Button button2;
  22. ? ? Button button3;
  23. ? ? Button button4;
  24. ? ? Button button5;
  25. ?
  26. ? ? @Override
  27. ? ? public void onCreate(Bundle savedInstanceState) {
  28. ? ? ? ? super.onCreate(savedInstanceState);
  29. ? ? ? ? setContentView(R.layout.activity_main);
  30. ?
  31. ? ? ? ? textview1=(TextView)findViewById(R.id.textview1);
  32. ?
  33. ? ? ? ? button1 = (Button)findViewById(R.id.button1);
  34. ? ? ? ? button2 = (Button)findViewById(R.id.button2);
  35. ? ? ? ? button3 = (Button)findViewById(R.id.button3);
  36. ? ? ? ? button4 = (Button)findViewById(R.id.button4);
  37. ? ? ? ? button5 = (Button)findViewById(R.id.button5);
  38. ? ? ? ? question2 = (RadioGroup) findViewById(R.id.radioGroup2);
  39. ?
  40. ? ? ? ? button1.setOnClickListener(listener);
  41. ? ? ? ? button2.setOnClickListener(listener);
  42. ? ? ? ? button3.setOnClickListener(listener);
  43. ? ? ? ? button4.setOnClickListener(listener);
  44. ? ? ? ? button5.setOnClickListener(listener);
  45. ? ? ? ? question2.setOnClickListener(listener);
  46. ?
  47. ? ? }
  48. ?
  49. ? ? public OnClickListener listener = new OnClickListener() {
  50. ? ? ? ? @Override
  51. ? ? ? ? public void onClick(View view) {
  52. ? ? ? ? ? ? switch (view.getId()){
  53. ? ? ? ? ? ? ? ? case R.id.button1:
  54. ? ? ? ? ? ? ? ? ? ? number(1);
  55. ? ? ? ? ? ? ? ? ? ? break;
  56. ? ? ? ? ? ? ? ? case R.id.button2:
  57. ? ? ? ? ? ? ? ? ? ? number(2);
  58. ? ? ? ? ? ? ? ? ? ? break;
  59. ? ? ? ? ? ? ? ? case R.id.button3:
  60. ? ? ? ? ? ? ? ? ? ? number(3);
  61. ? ? ? ? ? ? ? ? ? ? break;
  62. ? ? ? ? ? ? ? ? case R.id.button4:
  63. ? ? ? ? ? ? ? ? ? ? delete();
  64. ? ? ? ? ? ? ? ? ? ? break;
  65. ? ? ? ? ? ? ? ? case R.id.button5:
  66. ? ? ? ? ? ? ? ? ? ? result();
  67. ? ? ? ? ? ? ? ? ? ? break;
  68. ? ? ? ? ? ? ? ? default:
  69. ? ? ? ? ? ? ? ? ? ? break;
  70. ? ? ? ? ? ? }
  71. ?
  72. ? ? ? ? ? ? question2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
  73. ? ? ? ? ? ? ? ? @Override
  74. ? ? ? ? ? ? ? ? public void onCheckedChanged(RadioGroup group, int checkedId) {
  75. ? ? ? ? ? ? ? ? ? ? //获取被选择的单选按钮
  76. ? ? ? ? ? ? ? ? ? ? RadioButton r = (RadioButton) findViewById(checkedId);
  77. ? ? ? ? ? ? ? ? ? ? //Toast.makeText(MainActivity.this,"你的爱好是:" + r.getText(), Toast.LENGTH_SHORT).show();
  78. ? ? ? ? ? ? ? ? ? ? id = r.getId();
  79. ? ? ? ? ? ? ? ? ? ? textview1.setText(num + r.getText());
  80. ? ? ? ? ? ? ? ? ? ? fore = Integer.valueOf(num);
  81. ? ? ? ? ? ? ? ? ? ? num = num+ r.getText();
  82. ? ? ? ? ? ? ? ? ? ? lenth = num.length();
  83. ? ? ? ? ? ? ? ? }
  84. ? ? ? ? ? ? });
  85. ? ? ? ? ? ? textview1.setText(num);
  86. ? ? ? ? }
  87. ? ? };
  88. //乘号id是2131165311 ?加号id是2131165312
  89. ? ? private void result()
  90. ? ? {
  91. ? ? ? ? num_zong = num;
  92. ? ? ? ? num = num.substring(lenth);
  93. ? ? ? ? back = Integer.valueOf(num);
  94. ? ? ? ? if(id == 2131165311)
  95. ? ? ? ? ? ? num = String.valueOf((fore*back));
  96. ? ? ? ? else
  97. ? ? ? ? ? ? num = String.valueOf((fore+back));
  98. ? ? ? ? num = num_zong + "=" + num;
  99. ? ? }
  100. ?
  101. ? ? private void delete(){
  102. ? ? ? ? num = num.substring(0,num.length()-1);
  103. ? ? }
  104. ?
  105. ? ? private void number(int i){
  106. ? ? ? ? num = num + i;
  107. ? ? }
  108. }

四、总结

运行必须按照流程来,不然app会崩溃,不想改了,累了,对我这样的新手不太友好。

五、参考文章

 (更新后,更改了一些参数定义名称,更加直观,更改了一些函数内容,减少冗余度)

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持w3xue。

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号