Tag: recyclerview

How to scroll horizontal RecyclerView programmatically?

I have a horizontal RecyclerView and two button (Next,Previous) as shown in the image below. so i need to move to the next item or position by use these buttons , i know about method called scrollTo but i don’t know how does it work

RecyclerView ?android:attr/selectableItemBackground does not work on items

I have this items.xml <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”horizontal” android:layout_width=”match_parent” android:focusable=”true” android:clickable=”true” android:background=”?android:attr/selectableItemBackground” android:layout_height=”wrap_content”> <ImageView android:layout_width=”match_parent” android:layout_height=”60dp” android:id=”@+id/colorPreview” /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerInParent=”true” android:textAppearance=”@android:style/TextAppearance.Large” android:textColor=”@android:color/white” android:id=”@+id/colorName” /> </RelativeLayout> When I use it separately, the selectableItemBackground animates when I click the view. But when I use it for the items in a RecyclerView, the effect […]

How to set the height of an item row in GridLayoutManager

My Recycler Item which inflate in onCreateViewHolder <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:gravity=”center” android:orientation=”vertical” android:padding=”16dp”> <ImageView android:id=”@+id/gridListImageView” android:layout_width=”96dp” android:layout_height=”96dp” android:src=”@drawable/a” /> <TextView android:id=”@+id/gridListView_title” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”20dp” android:text=”Large Text” android:textAppearance=”?android:attr/textAppearanceLarge” /> </LinearLayout> I want to display something like this Which has one row of half the height of recycler View? And add padding to […]

Add clickListner for button inside a cardView populated using a recyclerView

I have a cardView card_contents.xml <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v7.widget.CardView android:layout_width=”match_parent” android:layout_height=”150dp” android:layout_marginTop=”10dp” android:layout_marginLeft=”5dp” android:layout_marginRight=”5dp” android:id=”@+id/card_view”> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”#ffa3a4a6″> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/card_text” android:layout_gravity=”center” android:gravity=”center” android:text=”B.E” android:layout_centerInParent=”true” /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true” android:id=”@+id/button1″ android:layout_toLeftOf=”@+id/view” android:layout_alignParentLeft=”true” android:text=”2010″ android:textColor=”#000000″ android:background=”@android:color/transparent” /> <View android:layout_width=”2dp” android:layout_height=”@dimen/abc_action_button_min_height_material” android:layout_centerHorizontal=”true” android:id=”@+id/view” android:background=”@android:color/black” android:layout_alignParentBottom=”true” /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/button2″ […]

Challenges in RecyclerView of Android L

I have been playing around with RecyclerView for a little bit. Is there any easy way to put OnClickListener for items in RecyclerView? I have tried implementing it in ViewHolder. The onClick event never got triggered. And I have used notifyItemInserted(position) for adding new value into RecyclerView. The UI does not got refreshed automatically. Needed […]

Issues recreating a material design lists with leave behind in Android

I’d like to recreate the Material Design list: controls in Android inside a sliding panel. I’m making use of: com.android.support:appcompat-v7 com.android.support:support-v4 com.android.support:recyclerview-v7 com.android.support:design https://github.com/umano/AndroidSlidingUpPanel https://github.com/serso/android-linear-layout-manager https://github.com/daimajia/AndroidSwipeLayout https://github.com/tmiyamon/gradle-mdicons I ended up using portions of the support libraries, but this specific app is 5.0+ only so there may be some Lollipop-only stuff in my code. Here is […]

how to disable recycler view scrolling so that it listens to Scrollview layout?

I have a recycler view inside a ScrollView. I want to disable the recycler view scroll so that it listens to its parent layout, A ScrollView!

How to make a page indicator for horizontal recyclerview

Any idea how to create a page indicator for recyclerview list ?

RecyclerView detaches view still visible

Current scenario I’m using this library https://github.com/kanytu/android-parallax-recyclerview to achieve a parallax effect on a RecyclerView. So far, so good. However I would like get an effect like Google Newsstand where the header is still bellow the cards. Problem The problem is that RecyclerView (or LinerLayoutManager) detaches the header view the moment the first element of […]

How to use ContentObserver with RecyclerView?

With ListView we have had a good native pattern to map some data from db to list: DB -> ContentProvider -> CursorLoader -> CursorAdapter -> ListView This approach was good in terms of data layer separation, performance and automatic data updates. But this pattern doesn’t really fit new RecyclerView. There are some approaches to mimic […]

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