android - Question about checkbox in recyclerView.
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-07-06 10:36:18
0
3
1622

As shown in the picture, click on the time of today’s checkbox. How to make all checkboxes selected? Please provide me with ideas

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(3)
phpcn_u1582

Xie Yao.

  1. Listen to checkbox events, copy, and operate sub-checkboxes

  2. Customized checkbox component. I wrote it myself and operate it however I want.

CheckBox repeatChkBx = ( CheckBox ) findViewById( R.id.repeat_checkbox );
repeatChkBx.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
    {
        if ( isChecked )
        {
            // perform logic
        }

    }
});
滿天的星座

Using CheckBox in RecyclerView will cause the reuse problem of ViewHolder. The reused CheckBox after sliding will inherit the previous state.

It is recommended to modify the selected state in the bound data entity instead of directly modifying the selected state of CheckBox. At the same time, in bindData, only control the state of CheckBox based on the selected state of the data.

Please ask, is this implemented by two layers of RecyclerView, ItemDecoration or different ViewTypes?

我想大声告诉你

I’ll give you a wheel, it’s actually very simple. Address: https://github.com/JerryMissT...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template