简体   繁体   中英

how to make set clickable false of recyclview cell

I am working on recycle view and want to disable click event at position, position get from api,

what i am trying :

     viewHolder. rl3_layout.setClickable(false);
     viewHolder. rl3_layout.setFocusable(false);
     viewHolder. rl3_layout.setEnabled(false);

but this is not working in my recyclview.

您是否尝试过将在您的onBindViewHolderonClickListeneritemView ,什么也不做?

You need to set the option in the OnBindViewHolder and for each item.

 if(shouldBeClickable) 
 {
    viewHolder. rl3_layout.setClickable(true);
    viewHolder. rl3_layout.setFocusable(true);
    viewHolder. rl3_layout.setEnabled(true);
 }
 else
 {
    viewHolder. rl3_layout.setClickable(false);
    viewHolder. rl3_layout.setFocusable(false);
    viewHolder. rl3_layout.setEnabled(false);
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM