recyclerview-layout

How to get view from RecyclerView at specific adapter position and get values from those views?

六月ゝ 毕业季﹏ 提交于 2019-11-30 05:09:54
问题 I have RecyclerView having an ImageView and a TextView for each row layout.In ViewHolder in RecyclerViewAdapter, I have click listener as v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Images i=list.get(getAdapterPosition()); i.setFlag(!i.getFlag()); list.set(getAdapterPosition(),(i)); notifyDataSetChanged(); } }); In that click listener I am changing Boolean flag such that it can show either an item is selected or not. Depending on it's value I want

RIpple effect on RecyclerView not working on light tap

烈酒焚心 提交于 2019-11-29 15:31:01
问题 I have tried to implement the ripple effect on my RecyclerView. Here's my layout for it : <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card" android:layout_marginTop="7dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_width="match_parent" android:layout_height="wrap_content" card_view:cardCornerRadius="5dp" android:clickable="true"

Skip items in recycler view

邮差的信 提交于 2019-11-29 13:53:46
Hi I want to skip some items from recyclerview . Here is the bit of code item_Data.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_marginTop="10dp" android:id="@+id/mainlayout" android:layout_height="wrap_content"> <ImageView android:visibility="gone" android:id="@id/image" android:layout_gravity="center" android:layout_width="100dp" android:layout_height="100dp" /> <TextView android:visibility="gone" android:textStyle="bold" android:id="@id/title" android:layout_gravity="center"

RecyclerView onCreateViewHolder Return Type Incompatibility With Multiple Custom ViewHolders

心不动则不痛 提交于 2019-11-28 02:49:16
问题 I'm trying to use multiple ViewHolders in a RecyclerView in order to swap these views out at run time. I have created two classes which extend RecyclerView.ViewHolder: MenuItemViewHolder public class MenuItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public TextView menuItemText; public ImageView menuItemPhoto; public RecyclerViewAdapter rva; public MenuItemViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(this); rva = caller;

RecyclerView causes issue when recycling

风格不统一 提交于 2019-11-27 08:43:43
I have a list of items that I created using RecyclerView . When the user clicks on one of them I change the background color of that selected item. The problem is, when I scroll through my items, and they get recycled, some of the items get the selected item's background color (which is wrong). Here you can see my Adapter 's code: public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.ViewHolder> { private static final String SELECTED_COLOR = "#ffedcc"; private List<OrderModel> mOrders; public OrderAdapter() { this.mOrders = new ArrayList<>(); } public void setOrders(List

Images not loading from URL by Picasso from Firebase Database

匆匆过客 提交于 2019-11-27 05:32:50
Firebase image Model class public class Category { private String Name; private String Image; public Category(String name, String image) { Name = name; Image = image; } public Category() { } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getImage() { return Image; } public void setImage(String image) { Image = image; } } Activity class public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { RecyclerView recyclerView; RecyclerView.LayoutManager layoutManager; FirebaseDatabase database;

RecyclerView causes issue when recycling

折月煮酒 提交于 2019-11-26 14:16:29
问题 I have a list of items that I created using RecyclerView . When the user clicks on one of them I change the background color of that selected item. The problem is, when I scroll through my items, and they get recycled, some of the items get the selected item's background color (which is wrong). Here you can see my Adapter 's code: public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.ViewHolder> { private static final String SELECTED_COLOR = "#ffedcc"; private List<OrderModel>

Images not loading from URL by Picasso from Firebase Database

匆匆过客 提交于 2019-11-26 09:04:50
问题 Firebase image Model class public class Category { private String Name; private String Image; public Category(String name, String image) { Name = name; Image = image; } public Category() { } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getImage() { return Image; } public void setImage(String image) { Image = image; } } Activity class public class Home extends AppCompatActivity implements NavigationView