android-recyclerview

Horizontal recyclerview with fading edges

落爺英雄遲暮 提交于 2019-12-28 13:36:07
问题 If I look at the stackoverflow app's horizontal recyclerview, I can see that they use the "fading edge" technique so that the user will know that there are items on the left and right of the recyclerview and he / she can scroll. In listview, I think this effect is enabled by calling the below as described by Romain Guy (http://www.curious-creature.com/category/android/page/2/): android:cacheColorHint="#00000000" No such option exist in Recyclerview unfort. Is there a built in method to allow

Nested Recyclerview scrolls by itself

别等时光非礼了梦想. 提交于 2019-12-28 05:14:28
问题 I have a parent recyclerview that has 3 child view in it. The last two of the child are recyclerview. Parent recyclerview - child view 1 - child view 2 (horizontal rv) - child view 3 (horizontal rv) The issue is every time this fragment is visible, it scrolls itself to align with child view 2 's bottom. I have set the parent rv to listen for scroll. This is what I end up with: dy: 108 dy: 72 dy: 75 dy: 62 dy: 48 dy: 42 dy: 34 dy: 27 dy: 22 dy: 16 dy: 12 dy: 10 dy: 7 dy: 5 dy: 3 dy: 3 dy: 1 dy

Android TabLayout inside Fragment

允我心安 提交于 2019-12-28 05:10:11
问题 I am using Navigation Drawer to navigate between fragments they all use the MainActivity toolbar but each fragment has it's own TabLayout with 3 tabs and in each tab I am using RecyclerView to show different text and images. I did this last time using actvities instead of fragments but now using the drawer it's beter to use fragments. I have got to a point where the tabs work but as soon as I put the ViewPager in and connect the adapters to the tabs and I open the new fragment from the drawer

What difference between static and non static viewholder in RecyclerView Adapter?

天涯浪子 提交于 2019-12-28 04:43:21
问题 What are the advantages of this approach (using static nested class in my class MyAdapter extends RecyclerView.Adapter): static class MyVH extends RecyclerView.ViewHolder {...} And this approach (using member inner class): class MyVH extends RecyclerView.ViewHolder {...} Or it doesn't affect performance and both approaches could be used? 回答1: It is more a java question than an Android question. It is recommended to use static for inner classes to avoid memory leaks if you will take their

Square layout on GridLayoutManager for RecyclerView

给你一囗甜甜゛ 提交于 2019-12-28 03:29:09
问题 I try to make a grid-layout with square images. I thought that it must be possible to manipulate the GridLayoutManager by manipulating onMeasure to do a super.onMeasure(recycler, state, widthSpec, widthSpec); instead of super.onMeasure(recycler, state, widthSpec, heightSpec); but unfortunately, that didn't work. Any ideas? 回答1: To have the square elements in my RecyclerView, I provide a simple wrapper for my root View element; I use the following SquareRelativeLayout in place of

How to update/refresh specific item in RecyclerView

∥☆過路亽.° 提交于 2019-12-28 03:24:07
问题 I'm trying to refresh specific item in RecyclerView . Story: Whenever user clicks on item, it shows AlertDialog . User can type some text by clicking ok button. I want to show this text in this item and show invisible ImageView - declared in XML and adapter ViewHolder - I used this function in AlertDialog Positive Button to update the item: private void updateListItem(int position) { View view = layoutManager.findViewByPosition(position); ImageView medicineSelected = (ImageView) view

RecycleView steals focus when inside a NestedScrollView

心已入冬 提交于 2019-12-28 02:49:11
问题 When I put a RecyclerView inside a nested scrollview, the screen always jumps to the top of the RecyclerView instead of the top of the page. Here is a simple example. layout xml: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical"

No good example about RecyclerView and StaggeredGridLayoutManager in Android Docs

谁说胖子不能爱 提交于 2019-12-27 17:03:45
问题 I couldn't find any better example for using RecyclerView with StaggeredGridLayoutManager . Not even in Android Docs. Q1. I need some examples which can give proper explanation about how to use RecyclerView with StaggeredGridLayoutManager . Q2. Can anyone tell me if it is possible to create following layout using RecyclerView with StaggeredGridLayoutManager So far i have found this link which is not at all useful. I also found this link for cardslib but it is too much complex in

No good example about RecyclerView and StaggeredGridLayoutManager in Android Docs

佐手、 提交于 2019-12-27 17:03:35
问题 I couldn't find any better example for using RecyclerView with StaggeredGridLayoutManager . Not even in Android Docs. Q1. I need some examples which can give proper explanation about how to use RecyclerView with StaggeredGridLayoutManager . Q2. Can anyone tell me if it is possible to create following layout using RecyclerView with StaggeredGridLayoutManager So far i have found this link which is not at all useful. I also found this link for cardslib but it is too much complex in

How to save scroll position of RecyclerView in Android?

人走茶凉 提交于 2019-12-27 14:55:50
问题 I have Recycler view which lays inside of SwipeRefreshLayout. Also, have ability to open each item in another activity. After returning back to Recycler I need scroll to chosen item, or to previous Y. How to do that? Yes, I googled, found articles in StackOverFlow about saving instance of layout manager, like this one: RecyclerView store / restore state between activities. But, it doesn't help me. UPDATE Right now I have this kind of resolving problem, but, of course, it also doesn't work.