大佬教程收集整理的这篇文章主要介绍了android – 无法取消选中动态广播组中已检查的单选按钮,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
private void radiotype() { count = //changed every time. LinearLayout llques = (LinearLayout) mview.findViewById(R.id.llrbgRBD); RadioGroup group = new RadioGroup(context); group.setOrientation(RadioGroup.VERTICAL); final RadioButton[] rb = new RadioButton[count]; List<String[]> ans = getAnswerList.getAns(); for (int j = 0; j < count; j++) { rb[j] = new RadioButton(context); rb[j].setVisibility(View.VISIBLE); rb[j].setText("`enter code here`hi"); String a = rb[j].getText().toString();`enter code here` Log.e("getAnswerList===a","getAnswerList===>a" + a); Log.e("getAnswerList","getAnswerList===>" + ans.get(indeX)[0]); if (a.equalsIgnoreCase(ans.get(indeX)[0])) { rb[j].setchecked(true); } rb[j].setTextColor(Color.bLACK); rb[j].setButtonDrawable(R.drawable.custom_radio_button); group.addView(rb[j]); } llques.removeAllViews(); llques.addView(group); group.setOncheckedchangelistener(new Oncheckedchangelistener() { public void oncheckedChanged(RadioGroup group,int checkedId) { // checkedId is the RadioButton SELEcted //int c = count; for(int i=0;i<count;i++){ rb[i].setchecked(false); } // Log.v("id",""+checkedId); for (int i = 0; i < count; i++) { if (rb[i].getId() == checkedId){ rb[i].setchecked(true); } } } });
以上是大佬教程为你收集整理的android – 无法取消选中动态广播组中已检查的单选按钮全部内容,希望文章能够帮你解决android – 无法取消选中动态广播组中已检查的单选按钮所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。