Android CheckBox ?算器开发(源码)
2010-05-28 14:57:00 来源:WEB开发网42 mEditText1=(EditText)findViewById(R.id.second);
43 list=new OnKeyListener() {
44
45 @Override
46 public boolean onKey(View v, int keyCode, KeyEvent event) {
47 // TODO Auto-generated method stub
48 if(mBox1.isChecked())
49 {
50 mBox1.setChecked(false);
51 }
52 if(mBox2.isChecked())
53 {
54 mBox2.setChecked(false);
55 }
56 if(mBox3.isChecked())
57 {
58 mBox3.setChecked(false);
59 }
60 if(mBox4.isChecked())
61 {
62 mBox4.setChecked(false);
63 }
64
65 return false;
66 }
67 };
68 mEditText.setOnKeyListener(list);
69 mEditText1.setOnKeyListener(list);
70
71
72
73 listner=new OnCheckedChangeListener() {
74
75 @Override
76 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
77 // TODO Auto-generated method stub
78 switch (buttonView.getId()) {
79 case R.id.Plus:
80 if(!isEmpty(mEditText,mEditText1))
81 {
82 Confirm();
83 mBox1.setChecked(false);
84 return;
85 }
86 break;
87 case R.id.Cut:
88 if(!isEmpty(mEditText,mEditText1))
89 {
90 Confirm();
91 mBox2.setChecked(false);
92 return;
93 }
94 break;
95 case R.id.Ride:
96 if(!isEmpty(mEditText,mEditText1))
97 {
98 Confirm();
99 mBox3.setChecked(false);
100 return;
101 }
102 break;
103 case R.id.Except:
104 if(!isEmpty(mEditText,mEditText1))
105 {
更多精彩
赞助商链接