Tag: recyclerview

how to open a different fragment on recyclerview OnClick

I am using a RecyclerView to display my drawer list item in my Navigation Drawer. OnClick of the drawer list item, I am able to open different activities, however I would like to be able to open fragments which will be replacing the main activity layout. Is there a way to do this? public class […]

How to get the height of recyclerview 's item in “onBindViewHolder”

The height of RecyclerView’s item is not fixed,i need to set the background image for every item,so I want to get the height of recyclerview‘s item to resize the Image,but the itemView.getHeight() always return 0 in onBindViewHolder. I have try to search many questions or articles,but i still cant get a good soluation.

Search through RecyclerView using Searchview

I want to search through RecyclerView, I have List<BaseOfCards> (BaseOfCards is my getter&setter class) My RecyclerViewAdapter : public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> { private LayoutInflater inflater; private List<BaseOfCards> items; //private int itemLayout; //String cardvalue; private Activity mActivity; public RecyclerViewAdapter(Activity mActivity, Context context, List<BaseOfCards> items) { this.mActivity = mActivity; inflater = LayoutInflater.from(context); this.items = items; //this.itemLayout […]

Android Ripple Effect Overridden by Selected State

After having been looking for a while I’ve not been able to find an answer to this… I have a recycler view with items which when selected have a red background and white text (beforehand the background is white and text is black). To do this I am using a selector. I have recently tried […]

How to add recycle view in layout xml

I am following this link, as mentioned in the link I am trying to add recycle view as follows: <android.support.v7.widget.RecyclerView android:id=”@+id/my_recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”vertical” /> I have added android-support-v7-appcompat library project and also tried adding recyclerview-v7-21.0.0-rc1.aar to libs but still I am getting following error. The following classes could not be found: – android.support.v7.widget.RecyclerView Note: […]

Recyclerview(Getting item on Recyclerview)

I’ve implemented SearchView + Recyclerview using this on github. GITHUB My next step is to get the item on selected part on the recyclerview. Then I saw some code getting the child on recyclerview. The code is working when the getChildAt(index) =0. But when i put on index=12 or greater than that. The program crashed. […]

java.lang.IllegalStateException: RecyclerView has no LayoutManager in Fragment

I was in the process of changing an Activity into a Fragment and got the following error as soon as I inflated the RecyclerView. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { —-> View rootView = inflater.inflate(R.layout.layout_containing_recyclerview, container, false); java.lang.IllegalStateException: RecyclerView has no LayoutManager Before I changed my Activity to a Fragment the […]

RecyclerView – No animation on NotifyItemInsert

For some reason, when adding a new item to the RecyclerView (should be inserted to the top of the list), it won’t show up unless I scroll down the list and back up to the top, and without any animation either. (Just appears at the top of the list as if it was there the […]

Different (dynamic) items height in GridLayoutManager

I have a RecyclerView and GridLayoutManager with 2 columns. How can I force LayoutManager to be according with template on the first screenshot? Now I have result as on the 2th screenshot. Need result: Current result:

RecyclerView item width layout_width=“match_parent” does not match parent

I’m using RecyclerView and I’m trying to make the width item of RecyclerView match_parent since I’m using LinearLayoutManager.HORIZONTAL <android.support.v7.widget.RecyclerView android:id=”@+id/listOffersHits” android:layout_width=”match_parent” android:layout_height=”match_parent” /> custom_layout.xml <?xml version=”1.0″ encoding=”utf-8″?> <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_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_gravity=”center” android:layout_weight=”1″ android:layout_margin=”2dp” card_view:cardCornerRadius=”2dp”> <ImageView android:id=”@+id/offerImage” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@drawable/item_selector” android:scaleType=”fitXY” android:src=”@drawable/offer” /> </android.support.v7.widget.CardView> LayoutManager LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(),LinearLayoutManager.HORIZONTAL, false); listOffersHits.setLayoutManager(linearLayoutManager); ViewHolder […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.