android-recyclerview

Moving a RecyclerView via Touch or Gesture Recognition

こ雲淡風輕ζ 提交于 2020-01-11 12:39:29
问题 I am attempting to move and grow, a RecyclerView so that the contents take up the full screen base on touch input. I want the RecyclerView to maintain the ability to scroll left and right. I was unable to get a GestureDetector to work properly with the RecyclerView. Catching the onScrollChange doesn't work as it may not have the ability to scroll. I attempting onTouchEvent but the results were rather buggy. Does anyone have any advice? Repo: https://github.com/CubanAzcuy/Animation-Test

How to load large number of images in recyclerview?

丶灬走出姿态 提交于 2020-01-11 07:52:21
问题 I have an activity where user is allowed to select around 500 images and then moves to next activity where those images will populated in a RecyclerView, how should i make it all work, for smooth user experience and better performance. Currently i'm passing the images as bitmaps using intents. I'm using the photopicker library for photo selection, here user is allowed to select multiple images and the filepath of all the selected images gets stored in a string Arraylist, which gets returned

How to disable RecyclerView scrolling to make the layout listen its ScrollView parent?

非 Y 不嫁゛ 提交于 2020-01-11 06:51:49
问题 I'm trying to put a RecyclerView , inside a ScrollView . But the ScrollView doesn't scrolls and the RecyclerView does but I don't want it to... What can I do? I tried with this class https://stackoverflow.com/a/30222721/4864104 and in fact the RecyclerView doesn't scroll anymore, but neither does the ScrollView . Any help to make the ScrollView work even with the disabled RecyclerView ? Thanks in advance. This is my layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res

Espresso - Check RecyclerView items are ordered correctly

时光总嘲笑我的痴心妄想 提交于 2020-01-11 06:21:11
问题 How to go about checking whether RecyclerView items are displayed in the correct order using Espresso? I'm trying to test it checking it by the text for the title of each element. When I try this piece of code it works to click the element but can't go on to instead of performing a click trying to Assert the text for the element onView(withId(R.id.rv_metrics)).perform(actionOnItemAtPosition(0, click())); When I try to use a custom matcher instead I keep getting the error Error performing

Espresso - Check RecyclerView items are ordered correctly

限于喜欢 提交于 2020-01-11 06:21:11
问题 How to go about checking whether RecyclerView items are displayed in the correct order using Espresso? I'm trying to test it checking it by the text for the title of each element. When I try this piece of code it works to click the element but can't go on to instead of performing a click trying to Assert the text for the element onView(withId(R.id.rv_metrics)).perform(actionOnItemAtPosition(0, click())); When I try to use a custom matcher instead I keep getting the error Error performing

Click an ImageButton which belongs to a CardView inside a RecyclerView

百般思念 提交于 2020-01-11 06:04:56
问题 SOLVED I've fixed it mixing your answers, so I've decided to write down on here. The key has been the ViewHolder constructor: I have deleted the setOnClickListener() and the onClick() methods and I´ve defined this inner class in my ObjectAdapter.java . public static class ViewHolder extends RecyclerView.ViewHolder{ public ViewHolder(View itemView) { super(itemView); card_first_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position =

Is there a RecyclerView equivalent to ListView's transcriptMode alwaysScroll?

假如想象 提交于 2020-01-11 06:01:07
问题 With ListView, I could easily implement an auto-scrolling chat view by setting: android:transcriptMode="alwaysScroll" in its XML. Is there an equivalent in RecyclerView? http://developer.android.com/reference/android/widget/AbsListView.html#attr_android:transcriptMode 回答1: RecyclerView doesn't seem to have that option. You have to manually scroll. Do something like.... notifyItemInserted(int posn); recyclerView.smoothScrollToPosition(la.getItemCount()); // <= use this. Also void

GridLayoutManager Span Size RecycleView

时间秒杀一切 提交于 2020-01-11 03:34:07
问题 I'm trying to achieve a layout similar to the picture above with the RecyclerView in conjunction with the GridLayoutManager, i tried setting the setSpanSizeLookup based on position but couldn't mimic the design above.. anyone could help please? UPDATE 回答1: private GridLayoutManager getGridLayoutManager() { final GridLayoutManager manager = new GridLayoutManager(getActivity(), 6); manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position)

Click through a RecyclerView list item

霸气de小男生 提交于 2020-01-11 02:09:30
问题 I have a RecyclerView with a LinearLayoutManager and an Adapter : @Override public int getItemViewType(int position) { return position == 0? R.layout.header : R.layout.item; } Here's header.xml : <View xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/header" android:layout_width="match_parent" android:layout_height="@dimen/header_height" /> What I want to achieve is to have a hole in the RecyclerView where I can click through to anything behind the RecyclerView . I

How to find percentage of each visible item in recycleview

让人想犯罪 __ 提交于 2020-01-10 19:32:12
问题 int findFirstVisibleItemPosition(); int findFirstCompletelyVisibleItemPosition(); int findLastVisibleItemPosition(); int findLastCompletelyVisibleItemPosition(); All this method is giving which item is visible, but how to find percentage of visible item in Recycleview? i.e findFirstVisibleItemPosition(); is giving position of first visible item but I want to perform some operation when first is visible more then 50 percentage 回答1: You need to write addOnScrollListener() for recyclerview and