执行RadioGroup的check(Id)方法,会触发onCheckedChanged多次
2017-03-23 17:10
465 查看
在百度下找到解决方法,特此记录下,把RadioGroup下的所有子View(RadioButton)的Checked设置为true,经过测试发现,的确可以解决onCheckChanged的多次执行
方法一:
方法二:
上面两种方法执行后,发现RadioGroup的Check(id)方法不起作用了,小菜鸟不知道怎么解决这个问题,但是又想让app一启动就选中某个RadioButton,小菜鸟的解决是去掉上面的方法
方法一:
方法二:
方法一:
((RadioButton)mRgBottomTag.findViewById(R.id.rb_video)).setChecked(true); ((RadioButton)mRgBottomTag.findViewById(R.id.rb_Audio)).setChecked(true); 等等...
方法二:
for (int i = 0; i < mRgBottomTag.getChildCount(); ++i){ RadioButton rb = (RadioButton) mRgBottomTag.getChildAt(i); rb.setChecked(true); }
上面两种方法执行后,发现RadioGroup的Check(id)方法不起作用了,小菜鸟不知道怎么解决这个问题,但是又想让app一启动就选中某个RadioButton,小菜鸟的解决是去掉上面的方法
方法一:
((RadioButton)mRgBottomTag.findViewById(R.id.rb_video)).setChecked(true);
方法二:
for (int i = 0; i < mRgBottomTag.getChildCount(); ++i){ RadioButton rb = (RadioButton) mRgBottomTag.getChildAt(i); if(rb.getId() == R.id.rb_video){ rb.setChecked(true); } }
相关文章推荐
- android RadioGroup调用check(id)方法时,onCheckedChanged方法被执行多次解决办法
- [Android] RadioGroup调用check(id)方法时,onCheckedChanged被执行多次
- RadioGroup调用check(id)方法时,onCheckedChanged方法被执行多次解决办法
- RadioGroup调用check(id)方法时,onCheckedChanged方法被执行多次解决办法
- 调用RadioGroup的check(id)方法,监听onCheckedChanged方法被执行多次;调用clearCheck(),onCheckedChanged方法仍被执行的原因和解决办法
- RadioGroup调用check(id)方法时,onCheckedChanged方法被执行多次调用解决办法
- 调用RadioGroup的check(id)方法,监听onCheckedChanged方法被执行多次;调用clearCheck(),onCheckedChanged方法仍被执行的解决办法
- RadioGroup调用check(id)方法时,OnCheckedChangedListener被多次回调问题
- RadioGroup调用setcheck(bool)方法时,onCheckedChanged方法被执行多次解决办法
- 有关RadioGroup的OnCheckedChanged方法执行多次的探讨
- RadioGroup调用check(int)方法时,onCheckedChanged方法被执行两次
- 使用RadioGroup 的时候出现onCheckChanged() 执行了三次的问题和App重启页面重叠现象
- E/JavaBinder:FAILED BINDER TRANSACTION错误解决+RadioGroup调用check方法的时候,onCheckedChanged被调用多次的问题解决
- RadioGroup中作为Table时,切换时多次请求onCheckChangeListener
- 利用jquery右键菜单巧妙获取table的每行数据的id执行方法
- Struts2中Action的@BeforeResult方法被执行两次或多次解决办法
- 解决FileSystemWatcher事件多次触发的方法
- 有关viewController中viewDidLoad方法执行多次的问题
- 仅IE6/7/8中添加同一个事件handler多次触发后会执行多次
- Struts2中Action的@BeforeResult方法被执行两次或多次解决办法