小编hos*_*kha的帖子

Flutter:禁用平板电脑和 ipad 的应用程序

我正在开发一个关于 flutter 的应用程序,我想在 android 和 ios 上禁用该平板电脑应用程序。

android ios flutter

4
推荐指数
1
解决办法
6289
查看次数

如何用RecyclerView android选择一个RadioButton?

我有一个带RadioButton的RecyclerView我只想在同一时间选择一个RadioButton并且我的代码使它工作正常,但当我从上到下重复选择时,选择消失我怎么能修复它,谢谢.

在此输入图像描述

private RadioButton lastCheckedRB = null;

 @Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
    ContactUsModel contactUsModel = orderList.get(position);
    holder.orderNum.setText(contactUsModel.getOrderNum());
    holder.orderCost.setText(contactUsModel.getOrderCost());

    holder.radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            RadioButton checked_rb = (RadioButton) group.findViewById(checkedId);

            if (lastCheckedRB != null &&lastCheckedRB.isChecked()) {
                lastCheckedRB.setChecked(false);
            }
            //store the clicked radiobutton
            lastCheckedRB = checked_rb;


        }
    });
Run Code Online (Sandbox Code Playgroud)

android radio-button android-recyclerview

1
推荐指数
2
解决办法
4107
查看次数