android-recyclerview

RecyclerView not recycling views if the view count is small

China☆狼群 提交于 2021-02-07 02:31:32
问题 I've been dealing with a strange behavior in Recycler View, if the view count in the adapter is small, in my case with size 5, the views are not being recycled and onBindViewHolder is not called when the view is scrolled back to screen. If i increase the size to 10 views for example, then recycling starts working and onBindViewHolder is called every time a view enters the screen. XML <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipeRefresh" android:layout_width="wrap

RecyclerView “cannot resolve symbol” errors - Android Studio

杀马特。学长 韩版系。学妹 提交于 2021-02-06 15:18:23
问题 I am getting cannot resolve symbol errors on all my RecyclerView's. What is going on? Because I have an error with RecyclerView, I also have errors on LayoutManager. My last four Override statements are in the wrong place and I don't know where they go. I am a beginner and have a very basic knowledge of programming so I don't know how to fix this. I am taking a class but the professor isn't helpful at all. package com.bignerdranch.android.criminalintent; import android.content.Intent; import

Why use a CardView instead of a RelativeLayout or LinearLayout?

守給你的承諾、 提交于 2021-02-06 07:01:11
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

人盡茶涼 提交于 2021-02-06 06:56:39
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

邮差的信 提交于 2021-02-06 06:56:26
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

How to refresh data in a Firestore Paging Adapter using Swipe Refresh Layout

蓝咒 提交于 2021-02-05 08:58:26
问题 I am building an app that i would like to fetch data from Firestore and display it in recyclerview as the user scrolls. I am using FirestorePagingAdapter as described here: https://github.com/firebase/FirebaseUI-Android/tree/master/firestore#using-the-firestorepagingadapter. This adapter does not listen for realtime changes in the database, how do I manually force a refresh using swipeRefreshLayout? 回答1: The FirestorePagingAdapter will load the data fresh from the database whenever it shows a

How do i fix RecyclerView: No adapter attached; skipping layout?

与世无争的帅哥 提交于 2021-02-05 08:37:10
问题 I've been at this for while and i keep getting an error : E/RecyclerView: No adapter attached; skipping layout . I started changing things in ViewProfilePostsFragment where the setAdapter is called, i had no success in making it work. I cant seem to figure out why this is happening. Here are my scripts so you can tell me what i did wrong, there is the script that's calling the setAdapter method and another for the RecyclerAdapter script. ViewProfilePostsFragment.java public class

Update textview from Recyclerview Adapter class

北战南征 提交于 2021-02-05 07:12:26
问题 I'm working on a E-commerce App to place some online orders. In my Recyclerview there are products, which are added at the previous activity. Here i'm populating the added products in the Recyclerview with the details such as item name, qty, price etc.. There are buttons to increase/decrease the qty of each products and another button to delete the item too. At the bottom of the Recyclerview Layout there is another textview to Show the grand total. As I'm handling the button slicks in the

lateinit property data has not been initialized

老子叫甜甜 提交于 2021-02-05 05:57:26
问题 Gson Convertable data is not set in Recyclerview using Retrofit2 and rxjava2 then subscribe throughble its Give Error: UninitializedPropertyAccessException: lateinit property data has not been initialized JSON data parsing by retrofit2 and rxjava2. when parsing GSON Data Converting GSon, rxjava2 Subscribe the data then give lateinit property error and its not set in recyclerview. MainActivity.kt class Company : AppCompatActivity() { internal lateinit var api : APIInterface var

RecyclerView inside a RecyclerView

雨燕双飞 提交于 2021-02-04 21:34:21
问题 I have this RecyclerView , which in it every item has a RecyclerView inside of it: fragment_active_goals.xml (contains the outer recyclerview): <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/parent" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.ActiveGoalsFragment