Tag: recyclerview

RecyclerView overlapping without shadow

I want to develop List like this picture I had used to RecylerView ItemDecorator for overlap. But it’s overlapping without shadow. the screen & decorator code is below public class OverlapDecoration extends RecyclerView.ItemDecoration { private final static int vertOverlap = -50; @Override public void getItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { outRect.set(0, […]

Android sticky header RecyclerView/ Section Header RecyclerView

Hello All I have just created a demo to work with new android L widget RecyclerView.I have also implemented Pull-To-Refresh using SwipeRefreshLayout but problem for me now is how can I implement sticky header here,Because when i try to set mRecyclerView.setOnScrollListener(new OnScrollListener() { @Override public void onScrolled(int arg0, int arg1) { } @Override public void […]

How open fragment from RecyclerView.Adapter<CardAdapter.ViewHolder>

1.TabLayout – tab1 (Fragment1) – tab2 (Fragment2) – tab3 (Fragment3) * RecyclerView + CardView (OnClick) On CardView ClickListner open another fragment in tab3. So how to open fragment in tab3. Error is in getFragmentManager(): FragmentTransaction transaction = getFragmentManager().beginTransaction(); Instead of this, I tried: FragmentTransaction transaction = activity.getFragmentManager().beginTransaction(); FragmentTransaction transaction = itemview.getContext().getFragmentManager().beginTransaction(); But error is not […]

Android: Add divider between items in RecyclerView

I am using RecyclerView with rounded corner, to make it rounded corner I used below XML: view_rounded.xml:- <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”#008f8471″/> <stroke android:width=”2dp” android:color=”#ffffff” /> <corners android:radius=”10dp”/> </shape> fragment_main.xml:- <android.support.v7.widget.RecyclerView android:id=”@+id/recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@drawable/view_rounded”/> adapter_main.xml:- <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/LinearLayout1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical”> <TextView android:id=”@+id/textTitle” style=”@style/AppTheme.ListTextView” /> </LinearLayout> style.xml:- <style name=”AppTheme.ListTextView” parent=”android:Widget.Material.TextView”> <item […]

How to avoid double space between items when using RecyclerView with StaggeredGridLayoutManager?

I’m using RecyclerView with StaggeredGridLayoutManager to make a two-column list. But how to set a right margin between left column and right column. I have used this code to make right margin from top, but how to solve double space between to columns. public class SpacesItemDecoration extends RecyclerView.ItemDecoration { private int space; public SpacesItemDecoration(int space) […]

Android RecyclerView LayoutManager Exception

Hi I’m having an issue with the new Android Lollipop RecyclerView It keeps crashing with the following exception: Attempt to invoke virtual method ‘void android.support.v7.widget.RecyclerView$LayoutManager.onMeasure(android.support.v7.widget.RecyclerView$Recycler, android.support.v7.widget.RecyclerView$State, int, int)’ on a null object reference Full stack trace can found here The code used to initiate the RecyclerView is the same mostly the same as the tutorial, […]

RecyclerView with different Cardlayouts

What I’d like to do At the moment I’m playing around with RecyclerView and CardView‘s. For now I wrote a RecyclerView.Adapter on which I can display the same CardView multiple times with different content – analog to the ListView with a BaseAdapter. Now I’d like to write a RecyclerView with different CardView-Layout‘s (in style of […]

RecyclerView ScrollListener inside NestedScrollView

I have a EndlessRecyclerView at the end of a NestedScrollView. EndlessRecyclerView means: when user scrolls to the bottom of the recyclerView it loads more data. This is already implemented and working elsewhere but when I put the recyclerView inside the NestedScrollView the OnScrollListener events doesn’t fire. XML design: <NestedScrollView> <Other views/> <EndlessRecyclerView/> </NestedScrollView > Code: […]

RecyclerView laggy scrolling

I am loading 400×200 images in RecyclerView, but scrolling is laggy on 2k devices. I am using Picasso for loading images from resource. As you can see in the demo images are blurry on 2k screen, but if I load higher resolution images the situation gets worse. How to fix this, I am not even […]

RecyclerView.getChild(index) shows null when list is scrolled (index gets messed up)

I’ve been using SwipeableRecyclerView for my android application for enabling swipes for my recyclerView. RecyclerView contains a list of cardViews. I was trying to implement undo functionality for cards which will get deleted when swipe to left (first swipe shows undo, next swipe triggers delete) I am trying the following code (partially working I guess) […]

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