android-recyclerview

RecyclerView With CardView

强颜欢笑 提交于 2019-12-23 02:14:26
问题 I am using RecyclerView + CardView to list all the countries from A-Z like I have here But I want them to line up next to each other so save space like this What is the best way to achieve this? CardAdapter public class CardAdapter extends RecyclerView.Adapter<CardAdapter.ViewHolder> { List<Nationality> mItems; public CardAdapter() { super(); mItems = new ArrayList<Nationality>(); Nationality movie = new Nationality(); movie.setThumbnail(R.drawable.afghanistan); movie.setName("Afghanistan");

Empty View on a RecyclerView

徘徊边缘 提交于 2019-12-23 01:57:08
问题 In an app I am working on, I am using a Recycler View to show a list of items. I would like the list to display some view (For example, a text view) when the list is empty. I know that with ListViews, one could call setEmptyView , but RecyclerView has no such method. I have tried setting the visibility of a view to GONE, and making it visible when the RecyclerView dataset is empty, but adding any view to the layout file where the RecyclerView is defined leads to an error: Attempt to invoke

How to implement Firebase with ViewPager?

无人久伴 提交于 2019-12-23 01:54:23
问题 What is the best way to use firebase with ViewPager. Expected Output How can I use ViewPager with Firebase such that it notifies the firebase for the position and gets and attaches the data accordingly? Person.java public class Person { private String name; private String email; private String hobby; public Person(){ } public Person(String name , String email , String hobby){ this.name= name; this.email = email; this.hobby = hobby; } public void setName(String name) { this.name = name; }

Layout Jitter when Toolbar hides while scrolling RecyclerView

限于喜欢 提交于 2019-12-23 01:41:47
问题 Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset = 0; private int dp(int inPixels){ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, inPixels,

Layout Jitter when Toolbar hides while scrolling RecyclerView

僤鯓⒐⒋嵵緔 提交于 2019-12-23 01:41:35
问题 Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset = 0; private int dp(int inPixels){ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, inPixels,

Change layout screen in runtime with RecyclerView adapter

我是研究僧i 提交于 2019-12-22 14:06:05
问题 I have two layout files shown below. If data is present in list then I show this layout. and when list is empty then I show this layout. Now I wanted to change layout at runtime. When ever user deletes last item from list I wanted to change layout to 'Empty cart layout' shown in second image. In getItemCount() method of RecyclerView adapter if list is empty or null then I return count as 1 otherwise I return list.size() This is my adapter code. public class CheckOutAdapter extends

Recyclerview list end overlay color and alpha

天大地大妈咪最大 提交于 2019-12-22 13:54:02
问题 How can I change the grey or white overlay that comes on recyclerview when we try to scroll even when we reached the end(top or bottom) of list. I am not able to find the property name to which I can use to do it. 回答1: The RecyclerView take the shadow from the colorPrimary of your Theme. You need to create new theme for RecyclerView then apply this Theme to your RecyclerView In below example themes colorPrimary is colorGreen so it will take green color shadow. SAMPLE CODE <android.support.v7

RecyclerView and ViewPager with collapsing toolbar

房东的猫 提交于 2019-12-22 13:39:31
问题 I am trying to create this kind of a layout where - A CollapsingToolbarLayout that has a ViewPager like google play app. Below that there is a Grid RecyclerView . And at the end, there is another ViewPager . The RecylerView scrolls normally until the end when CollapsingToolbarLayout expands. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@

How to specify TransitionManager.beginDelayedTransition to affect only direct child views

a 夏天 提交于 2019-12-22 13:15:11
问题 I am trying to use a ConstraintLayout in conjunction with views that slide up and down with animation. These views are organized vertically, with a RecyclerView at the top and two other views stacked under it: <constraint layout container> [ ] [ recycler view ] [ ] [48dp height 1st view] [48dp height 2nd view] </constraint layout container> The animation is very simple: When a button is tapped the 1st view moves from the bottom of the container to the position you can see above, when tapped

Android RecyclerView addItemDecoration Won't Add Decoration to Bottom of RecyclerView

丶灬走出姿态 提交于 2019-12-22 12:49:10
问题 I cannot find an answer to this question anywhere online, so the answer must be so simple that no one cared to ask it, and I simply don't know it. Essentially, I want to add a horizontal line between every item in my recyclerView AND to the bottom of the RecyclerView. I have found a way to place a divider between every item in the RecyclerView, but not one at the end . According to the documentation (found here: https://developer.android.com/reference/android/support/v7/widget/RecyclerView