Tag: recyclerview

Drag and Drop between two RecyclerView

Is it possible to have feature like drag and drop between two different RecyclerView? I found library for drag and drop within RecyclerView. Please help me to improve this functionality.

How do I unit test (with JUnit or mockito) recyclerview item clicks

I am currently trying to unit test recyclerview addonitemclick listner, with either junit or mockito. here’s my code: private void mypicadapter(TreeMap<Integer, List<Photos>> photosMap) { List<PhotoListItem> mItems = new ArrayList<>(); for (Integer albumId : photosMap.keySet()) { ListHeader header = new ListHeader(); header.setAlbumId(albumId); mItems.add(header); for (Photos photo : photosMap.get(albumId)) { mItems.add(photo); } pAdapter = new PhotoViewerListAdapter(MainActivity.this, mItems); […]

android studio: gradle dependency error

In the following build.gradle, I added the configuration section to avoid double inclusion of support libraries. Support libraries are used in the main project and in the dependent projects like facebook sdk. Without the configuration section, I get “UNEXPECTED TOP-LEVEL EXCEPTION”. Adding that configuration makes the error go away and the app all works fine. […]

How to use SortedList in RecyclerView with Android data binding library?

Android data binding provides several Observable data interfaces including ObservableList. But SortedList (introduced in recent version of RecyclerView library) does not extend List at all. How could I use SortedList for RecyclerView with Android data binding library?

RecyclerView: how to clear cached/recycled views?

I use a RecyclerView to display a list of items with a list layout. I switch from a list layout to a grid layout, showing just a subset of all the data when in grid layout. This switch uses a different layout XML than when list layout is presented. All this works well, except that […]

Items of recyclerview confused

In my onBindViewHolder of my RecyclerView.Adapter<SearchAdapter.ViewHolder> when user clicks on cardview a button becomes visible. But when I’m scrolling recyclerview some other items buttons are shown as visible too. Why is this happening? this is my code: @Override public void onBindViewHolder(final ViewHolder viewHolder, final int position) { viewHolder.card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) […]

Views above and below RecyclerView

I have a RecyclerView which displays dynamic content. I would to display this RecyclerView in between other Views. For example, one View displayed above and one View displayed below the RecyclerView: View RecyclerView View However, whatever I try doesn’t seem to be working and the RecyclerView seems to take up the entire space. I believe […]

How can I fill RecyclerView with GridLayoutManager from right to left

I’m trying to fill some data into a RecyclerView with GridLayoutManager: GridLayoutManager layoutManager = new GridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false); This will fill the data into the grid from left to right. The first item will be put into top-left place, etc. But the app I’m developing is designed for an RTL language, so I need […]

What's the enhancement of RecyclerView over ListView?

RecyclerView is added into v7 support library since Android API 22 officially. And many people said that it is a enhancement over ListView and many brief introductions to the usage of it were posted over the internet. But most of these articles are very simple, shallow and hollow. The enhancement is just RecyclerView.ViewHolder, RecyclerView.ItemAnimator or […]

Using CardView and RecyclerView in my layout files throws an exception

So I’ve been taking a shot at the Material Design of Android Preview L. I imported both the CardView and the RecyclerView libraries. I use the Android Studio preview version 0.8.0. Have the latest SDK packages installed. Once I use them in my layout files though, the previewer throws an exception for both of them. […]

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