Android Studio实现计算器功能
实验一:做一个简单的计算器
1.创建布局文件Activity_main.xml
代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><EditTextandroid:id="@+id/result"android:layout_width="match_parent"android:layout_height="wrap_content"android:textSize="40sp"android:enabled="false"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:orientation="horizontal"><Buttonandroid:id="@+id/cls"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="C"android:textColor="#ffffff"/><Buttonandroid:id="@+id/div"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="/"android:textColor="#ffffff"/><Buttonandroid:id="@+id/mul"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="*"android:textColor="#ffffff"/><Buttonandroid:id="@+id/Backspace"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="Backspace"android:textAllCaps="false"android:textColor="#ffffff"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:orientation="horizontal"><Buttonandroid:id="@+id/seven"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="7"android:textColor="#ffffff"/><Buttonandroid:id="@+id/eight"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="8"android:textColor="#ffffff"/><Buttonandroid:id="@+id/nine"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="9"android:textColor="#ffffff"/><Buttonandroid:id="@+id/sub"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="-"android:textColor="#ffffff"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:orientation="horizontal"><Buttonandroid:id="@+id/four"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="4"android:textColor="#ffffff"/><Buttonandroid:id="@+id/five"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="5"android:textColor="#ffffff"/><Buttonandroid:id="@+id/six"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="6"android:textColor="#ffffff"/><Buttonandroid:id="@+id/add"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="+"android:textColor="#ffffff"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="2"android:orientation="horizontal"><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="1dp"android:layout_weight="1"android:orientation="horizontal"><Buttonandroid:id="@+id/one"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="1"android:textColor="#ffffff"/><Buttonandroid:id="@+id/two"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:textSize="20sp"android:text="2"android:textColor="#ffffff"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="1dp"android:layout_weight="1"><Buttonandroid:id="@+id/zero"android:layout_width="match_parent"android:layout_height="match_parent"android:text="0"android:textSize="20sp"android:textColor="#ffffff"/></LinearLayout></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:orientation="horizontal"><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:orientation="vertical"><Buttonandroid:id="@+id/three"android:layout_width="match_parent"android:layout_height="1dp"android:layout_weight="1"android:text="3"android:textSize="20sp"android:textColor="#ffffff"/><Buttonandroid:id="@+id/spot"android:layout_width="match_parent"android:layout_height="1dp"android:layout_weight="1"android:text="."android:textSize="20sp"android:textColor="#ffffff"/></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"><Buttonandroid:id="@+id/equal"android:layout_width="match_parent"android:layout_height="match_parent"android:text="="android:textSize="20sp"android:textColor="#ffffff"/></LinearLayout></LinearLayout></LinearLayout>
</LinearLayout>
2.创建Java文件ActivityMain.java
代码如下:
package com.example.a86761.zdj003; #换自己的工程名
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;public class MainActivity extends AppCompatActivity{private StringBuilder show_equation=new StringBuilder();//显示运算式private ArrayList calculate_equation;//计算式private int signal=0;//为0 时表示刚输入状态;为1 时表示当前在输出结果上继续输入@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);//初始化show_equation=new StringBuilder();calculate_equation=new ArrayList<>();Button zero=(Button)findViewById(R.id.zero);Button one=(Button)findViewById(R.id.one);Button two=(Button)findViewById(R.id.two);Button three=(Button)findViewById(R.id.three);Button four=(Button)findViewById(R.id.four);Button five=(Button)findViewById(R.id.five);Button six=(Button)findViewById(R.id.six);Button seven=(Button)findViewById(R.id.seven);Button eight=(Button)findViewById(R.id.eight);Button nine=(Button)findViewById(R.id.nine);Button cls=(Button)findViewById(R.id.cls);Button div=(Button)findViewById(R.id.div);Button mul=(Button)findViewById(R.id.mul);Button backspace=(Button)findViewById(R.id.Backspace);Button sub=(Button)findViewById(R.id.sub);Button add=(Button)findViewById(R.id.add);final Button equal=(Button)findViewById(R.id.equal);final Button point=(Button)findViewById(R.id.spot);final EditText result=(EditText)findViewById(R.id.result);result.setCursorVisible(true);disableShowInput(result);//点击文本框时光标始终在文本末尾result.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {result.setSelection(result.getText().length());}});zero.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v){if(!(show_equation.toString().equals("0"))){if(signal==0){show_equation.append("0");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("0");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}}});one.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("1");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("1");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});two.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("2");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("2");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});three.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("3");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("3");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});four.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("4");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("4");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});five.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("5");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("5");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});six.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("6");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("6");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});seven.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("7");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("7");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});eight.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("8");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("8");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});nine.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){show_equation.append("9");result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());show_equation.append("9");result.setText(show_equation);result.setSelection(result.getText().length());signal=0;}}});cls.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {show_equation.delete(0,show_equation.length());calculate_equation.clear();signal=0;result.setText("");}});backspace.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(!(show_equation.toString().equals(""))) {if(signal==0){show_equation.deleteCharAt(show_equation.length() - 1);result.setText(show_equation);result.setSelection(result.getText().length());}else{show_equation.delete(0,show_equation.length());result.setText("");signal=0;}}}});point.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {if(signal==0){String a=show_equation.toString();if(a.equals("")){show_equation.append(".");result.setText(show_equation);result.setSelection(result.getText().length());}else{int i;char t='0';for(i=a.length();i>0;i--){t=a.charAt(i-1);if(t=='.'||t=='+'||t=='-'||t=='*'||t=='/')break;}if(i==0){show_equation.append(".");result.setText(show_equation);result.setSelection(result.getText().length());}else if(t=='+'||t=='-'||t=='*'||t=='/'){show_equation.append(".");result.setText(show_equation);result.setSelection(result.getText().length());}}}else{show_equation.delete(0,show_equation.length());show_equation.append(".");result.setText(".");result.setSelection(result.getText().length());signal=0;}}});equal.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {//判断用户是否输入了内容if(!show_equation.toString().equals("")){signal=1;char temp=show_equation.charAt(show_equation.length()-1);if(show_equation.charAt(0)=='-')show_equation.insert(0,"0");if(temp=='+'||temp=='-')show_equation.append("0");if(temp=='*'||temp=='/')show_equation.append("1");StringBuilder temp1=new StringBuilder();for(int i=0;i<show_equation.length();i++){if(show_equation.charAt(i)>='0'&&show_equation.charAt(i)<='9'||show_equation.charAt(i)=='.'){temp1.append(String.valueOf(show_equation.charAt(i)));}else if(show_equation.charAt(i)=='N'){calculate_equation.add("NaN");//跳过2个字符i=i+2;}else if(show_equation.charAt(i)=='∞'){calculate_equation.add("∞");}else{if(temp1.length()!=0){calculate_equation.add(temp1.toString());temp1.delete(0,temp1.length());}calculate_equation.add(String.valueOf(show_equation.charAt(i)));}}if(temp1.length()!=0){calculate_equation.add(temp1.toString());}calculate_equation.add("#");String temp8=calculate(calculate_equation);result.setText(temp8);result.setSelection(result.getText().length());show_equation.delete(0,show_equation.length());calculate_equation.clear();show_equation.append(temp8);}}});add.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {//判断用户是否输入了内容if(!(show_equation.toString().equals(""))) {signal=0;char temp=show_equation.charAt(show_equation.length()-1);if(temp=='+'||temp=='-'||temp=='*'||temp=='/'){show_equation.deleteCharAt(show_equation.length()-1);show_equation.append("+");}elseshow_equation.append("+");result.setText(show_equation);result.setSelection(result.getText().length());}}});sub.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {//判断用户是否输入了内容if(!(show_equation.toString().equals(""))) {signal=0;char temp=show_equation.charAt(show_equation.length()-1);if(temp=='+'||temp=='-'||temp=='*'||temp=='/'){show_equation.deleteCharAt(show_equation.length()-1);show_equation.append("-");}elseshow_equation.append("-");result.setText(show_equation);result.setSelection(result.getText().length());}}});mul.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {//判断用户是否输入了内容if(!(show_equation.toString().equals(""))) {signal=0;char temp=show_equation.charAt(show_equation.length()-1);if(temp=='+'||temp=='-'||temp=='*'||temp=='/'){show_equation.deleteCharAt(show_equation.length()-1);show_equation.append("*");}elseshow_equation.append("*");result.setText(show_equation);result.setSelection(result.getText().length());}}});div.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {//判断用户是否输入了内容if(!(show_equation.toString().equals(""))) {signal=0;char temp=show_equation.charAt(show_equation.length()-1);if(temp=='+'||temp=='-'||temp=='*'||temp=='/'){show_equation.deleteCharAt(show_equation.length()-1);show_equation.append("/");}elseshow_equation.append("/");result.setText(show_equation);result.setSelection(result.getText().length());}}});}protected boolean operatorPriorityCompare(char operator1,char operator2){int o1=0;int o2=0;switch (operator1){case '+':{o1=0;break;}case '-':{o1=0;break;}case '*':{o1=1;break;}case '/':{o1=1;break;}}switch (operator2){case '+':{o2=0;break;}case '-':{o2=0;break;}case '*':{o2=1;break;}case '/':{o2=1;break;}}if(o1<=o2){return false;}elsereturn true;}//相加public static Double Add(Double d1,Double d2) {if(d1==Double.NEGATIVE_INFINITY||d1==Double.POSITIVE_INFINITY||d2==Double.NEGATIVE_INFINITY||d2==Double.POSITIVE_INFINITY){return d1+d2;}if(String.valueOf(d1).equals("NaN")||String.valueOf(d1).equals("NaN")){return d1+d2;}BigDecimal b1 = new BigDecimal(Double.toString(d1));BigDecimal b2 = new BigDecimal(Double.toString(d2));return b1.add(b2).doubleValue();}//相减public static Double Sub(Double d1,Double d2){if(d1==Double.NEGATIVE_INFINITY||d1==Double.POSITIVE_INFINITY||d2==Double.NEGATIVE_INFINITY||d2==Double.POSITIVE_INFINITY){return d1-d2;}if(String.valueOf(d1).equals("NaN")||String.valueOf(d1).equals("NaN")){return d1-d2;}if(String.valueOf(d1).equals("NaN")||String.valueOf(d1).equals("NaN")){return d1*d2;}BigDecimal b1=new BigDecimal(Double.toString(d1));BigDecimal b2=new BigDecimal(Double.toString(d2));return b1.subtract(b2).doubleValue();}//相乘public static Double Mul(Double d1,Double d2){if(d1==Double.NEGATIVE_INFINITY||d1==Double.POSITIVE_INFINITY||d2==Double.NEGATIVE_INFINITY||d2==Double.POSITIVE_INFINITY){return d1*d2;}if(String.valueOf(d1).equals("NaN")||String.valueOf(d1).equals("NaN")){return d1*d2;}BigDecimal b1=new BigDecimal(Double.toString(d1));BigDecimal b2=new BigDecimal(Double.toString(d2));return b1.multiply(b2).setScale(8).doubleValue();}//相除public static Double Div(Double d1,Double d2){if(d1==Double.NEGATIVE_INFINITY||d1==Double.POSITIVE_INFINITY||d2==Double.NEGATIVE_INFINITY||d2==Double.POSITIVE_INFINITY){return d1/d2;}if(String.valueOf(d1).equals("NaN")||String.valueOf(d1).equals("NaN")){return d1/d2;}if(d1==0.0&&d2==0.0){return Double.NaN;}if(d2==0.0){return d1/d2;}BigDecimal b1=new BigDecimal(Double.toString(d1));BigDecimal b2=new BigDecimal(Double.toString(d2));return b1.divide(b2,8,BigDecimal.ROUND_HALF_UP).doubleValue();}protected String calculate(ArrayList equation){Double temp2;Double temp3;Double result;List operator=new ArrayList();List<Double> operand=new ArrayList();for(int i=0;i<equation.size();i++){String temp4=(String) equation.get(i);if(temp4.equals("+")||temp4.equals("-")||temp4.equals("*")||temp4.equals("/")){if(operator.size()>0){String temp5=operator.get(operator.size()-1).toString();while(!(operatorPriorityCompare(temp4.charAt(0),temp5.charAt(0)))&&operator.size()>0){operator.remove(operator.size()-1);temp3=operand.get(operand.size()-1);operand.remove(operand.size()-1);temp2=operand.get(operand.size()-1);operand.remove(operand.size()-1);switch (temp5.charAt(0)){case '+':{result=Add(temp2,temp3);operand.add(result);break;}case '-':{result=Sub(temp2,temp3);operand.add(result);break;}case '*':{result=Mul(temp2,temp3);operand.add(result);break;}case '/':{result=Div(temp2,temp3);operand.add(result);break;}}if(operator.size()>0){temp5=operator.get(operator.size()-1).toString();}elsebreak;}operator.add(temp4);}elseoperator.add(temp4);}else if(temp4.equals("#")){while(operator.size()>0){String temp6=(String)operator.get(operator.size()-1);operator.remove(operator.size()-1);temp3=operand.get(operand.size()-1);operand.remove(operand.size()-1);temp2=operand.get(operand.size()-1);operand.remove(operand.size()-1);switch (temp6.charAt(0)){case '+':{result=Add(temp2,temp3);operand.add(result);break;}case '-':{result=Sub(temp2,temp3);operand.add(result);break;}case '*':{result=Mul(temp2,temp3);operand.add(result);break;}case '/':{result=Div(temp2,temp3);operand.add(result);break;}}}}else{if(temp4.equals("NaN")){operand.add(Double.NaN);}else if(temp4.equals("∞")){operand.add(Double.POSITIVE_INFINITY);}else{operand.add(Double.parseDouble(temp4));}}}if(operand.get(0)==Double.NEGATIVE_INFINITY) return "-∞";if(operand.get(0)==Double.POSITIVE_INFINITY) return "∞";return operand.get(0).toString();}//当API最低版小于21时使用这个函数实现点击文本框不弹出键盘public void disableShowInput(EditText et) {Class<EditText> cls = EditText.class;Method method;try {method = cls.getMethod("setShowSoftInputOnFocus", boolean.class);method.setAccessible(true);method.invoke(et, false);} catch (Exception e) {e.printStackTrace();}}
}
运行截图:
Android Studio实现计算器功能相关推荐
- 初学编程 第一个小程序Android studio实现计算器功能
源代码下载:https://gitee.com/zha-yingying/calculator.git 1.建立一个新的Layout,我这里使用的是GridLayout(网格布局),提取屏幕宽度(方便 ...
- Android Studio 3.4功能
Android Studio 3.4 is now available in stable channel. You can download it from here. In this quick ...
- Android Studio 3.3功能
Android Studio 3.3 is the latest stable release. In this tutorial, we'll discuss the new features av ...
- Android studio制作计算器源代码
版权声明:本文为博主原创文章,未经博主允许不得转载.https://mp.csdn.net/postedit/82623704 一.Android studio制作计算器源代码 这是我学Android ...
- 基于Android Studio实现的功能强大的购物商城APP源码,可做Android Studio毕业设计、大作业
Android 购物商城app 完整代码下载地址:基于Android Studio实现的功能强大的购物商城APP源码 实现的功能: 注册 登录 修改密码 重置密码(邮箱验证,考核结束将移除授权码) 商 ...
- Android studio实现计数器功能
Android studio实现计数器功能 我们使用原生计时器CountDownTimer 1.首先自己建立一个布局TextView------(countdown我自己定义的名字)可以显示文字 2. ...
- Android Studio实现多功能日记本
项目目录 一.项目概述 二.系统特点 三.开发环境 四.详细设计 1.E-R图 2.数据库 3.系统设置 五.运行演示 六.源码获取 一.项目概述 本次实现了功能实用且齐全的日记本,界面友好,使用便捷 ...
- android studio 九宫格,Android Studio 实现九宫格功能
运行结果 1.图 2.动图 九个图标是设置的,你也可以设置4 * 4 = 16都可以. 3.分享个GIF动图的.exe 代码activity_main.xml item.xml MainActivit ...
- Android studio 简易计算器App的实现及实现加减乘除功能(附完整源码)
在Android studio 实现简易计算器App并实现加减乘除功能 结果 activity_main.xml <?xml version="1.0" enco ...
- Android studio 实现计算器android 开发小实验
Android 移动开发实现简单计算器功能 前言 android 开发小实验 android 移动开发实现 简易计算器功能 小白也能轻松上手,复制粘贴就可使用 使用工具 Android Studio ...
最新文章
- 层次建模---建模软件包
- 交管12123显示当前环境存在风险_政策|取消驾驶证年龄上限、推行异地通办,12项交管新政来了...
- Django框架(24.Django中的模板的自定义过滤器)
- Python字符串拼接的十种方式
- Flash Builder 创建CSS
- Selenium私房菜系列8 -- 玩转Selenium Server
- android ios mp4格式转换,ios格式转换器
- java 中的流_深入理解Java中的流(Stream)
- python 计算机程序设计-某高校计算机编程教授教你如何快速入门python,一文带你进入编程...
- Python--29 魔法方法:定制序列
- 190402每日一句
- Java Web应用开发实用教程_Java Web应用开发实用教程
- Javascript带参跳转页面
- 计算机基本应用Excel考题,excel考题_大学计算机基础期末考试试题word ppt excel的操作题_淘题吧...
- codeforces 1183H 动态规划
- MySQL基础(补充)
- Java210道常见的面试
- 准确率100%,阿里商旅账单系统架构设计实践
- PS 十分钟教你做出文字穿插效果
- 一个c加一个g是什么牌子_车标是一个很神奇的存在 那你知道“G”是什么汽车吗?...
热门文章
- 2017博鳌亚洲青年论坛(香港)顺利召开 中国发展人工智能优势在哪?
- 用74161设计十二进制计数器
- 信息系统项目管理师 - 必考记忆口诀
- 郑州市暂住证(居住证)、迁户口办理-2018年
- 透视效果的十字路口,不再“亲人两行泪”
- 基于Basys3设计的FPGA多功能电子琴
- 怎样批量修改图片尺寸?
- 如何获得哔哩哔哩上下载的教学视频在电脑上看?(bilibili音频视频分离)
- 音频帧率计算方法(只需要知道 采样率 和 一帧采样数 )
- 需要在计算机安装msxml版本,Office2010安装需要MSXML版本6.10.1129.0的方法