Posts

Showing posts from 2017

Android RecyclerView Example

Image
Recently for my app, I needed to provide a scrollable list of clickable items. After doing a little research I found that the RecyclerView is the recommended choice since it recycles view items that are not in the user's focus. Here is a sample app that I created to demonstrate how to implement such a list. Here is what the app looks like. Now to get into the details of how to implement this list. First, let's take a look at how the RecyclerView is setup in a layout XML file. Note: I referenced the Google example, Creating Lists and Cards , which is why the code looks very similar. activity_main.xml 1| <?xml version="1.0" encoding="utf-8"?> 2| <LinearLayout> 3| xmlns:android="http://schemas.android.com/apk/res/android" 4| xmlns:tools="http://schemas.android.com/tools" 5| android:id="@+id/activity_main" 6| android:orientation="vertical" 7| android:layout_width=&quo