how can change some item view in recyclerview adapter?

时间:2018-02-03 08:01:29

标签: android android-recyclerview adapter

I have a RecyclerView and a button in different layout. Now, I want to change all item views with setonclicklistener ? for example when i setonclick listener method all item views gone button expect this item that was clicked on it

4 个答案:

答案 0 :(得分:0)

For one Line question here is One line Answer

Reload/Clear the recyclerView on onClick() of your View or set the different Adapter and clear the previous according to you.

答案 1 :(得分:0)

You can create a new activity and have same layout as of the recyclerview. when you click on the item, you can send data of that row using bundle. retrieve bundle data and set on the newly created activity's components

答案 2 :(得分:0)

If i got your questin:

when click button you want to change itemView layout

    buttonOne.setOnClickListener(new View.OnClickListener() {
                                                @Override
         public void onClick(View view) {
        LocationListAdapter adapter=new LocationListAdapter(this,R.layout.layout_one,  addressList); 
        locationListRecyclerview.setAdapter(adapter);   
        }
          });

答案 3 :(得分:0)

You can reset the adapter with new one, on the click listener of button and if you do not want to change the whole view of the item then update the list binding to your current adapter and notify the adapter in the click listener.