小编sam*_*ria的帖子

无法取消选中动态广播组中已检查的单选按钮

如果我第一次设置一个单选按钮,它可以正常工作.但如果我通过调用.setChecked(false)取消选择它; 然后,即使我试图通过调用setChecked(true)来选择它也不会取消选择前一个.

    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 …
Run Code Online (Sandbox Code Playgroud)

android unchecked radio-button

5
推荐指数
2
解决办法
2441
查看次数

AutoCompleteTextView下拉列表文本根据搜索文本突出显示

我已经AutoCompleteTextView在我的应用程序中实现了搜索字段。

我想突出显示在AutoCompleteTextView(搜索文本字段)中输入的文本,以在下拉列表中突出显示。我怎样才能做到这一点?。

android autocompletetextview

5
推荐指数
1
解决办法
1056
查看次数