android-recyclerview

RecyclerView / DiffUtils animation when dataset change without full refresh

人盡茶涼 提交于 2020-04-10 05:23:13
问题 I would like two things : To not reload / refresh the adapter when i delete an item inside RecyclerView (no use of notifyDatasetChanged ). To do so i am using DiffUtils which works perfectly fine. But i also would like to keep the DefaultItemAnimator of the RecyclerView which has apparently no effect with DiffUtils. So my question is : How can i remove / update an item without refreshing all the dataset AND keep a similar animation to the DefaultItemAnimator ? I know many posts gives answers

Android percent screen width in RecyclerView item

冷暖自知 提交于 2020-04-08 19:02:17
问题 How would I get a RecyclerView's item height to be, say, 30% of the screen's height? I can't simply use a ConstraintLayout or a PercentFrameLayout/PercentRelativeLayout, since those position child layouts relative to parent layouts, whose size might not match the screens. Preferably, I'd like to do this in pure XML (and not have to use any Runnables to get the screen height dynamically). EDIT To clarify, since a lot of solutions suggest restraining the height of the RecyclerView, that's not

Android percent screen width in RecyclerView item

耗尽温柔 提交于 2020-04-08 19:01:52
问题 How would I get a RecyclerView's item height to be, say, 30% of the screen's height? I can't simply use a ConstraintLayout or a PercentFrameLayout/PercentRelativeLayout, since those position child layouts relative to parent layouts, whose size might not match the screens. Preferably, I'd like to do this in pure XML (and not have to use any Runnables to get the screen height dynamically). EDIT To clarify, since a lot of solutions suggest restraining the height of the RecyclerView, that's not

How to sync TabLayout with Recyclerview?

流过昼夜 提交于 2020-04-08 05:57:52
问题 I have a TabLayout with Recyclerview so that when tabs are clicked then the Recyclerview is scrolled to a particular position. I want the reverse procedure as well such that when the Recyclerview is scrolled to a particular position then the particular tab is highlighted. For example: If there are 4 tabs in the TabLayout and when Recyclerview is scrolled to 5th position(Item visible and below TabLayout ) then 3rd tab should be highlighted. Here when 'How it works' appears below TabLayout then

Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging

房东的猫 提交于 2020-04-05 06:48:13
问题 Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging I am using fragment reusability .but add second time fragment then start this problem. I am remove image load library but not any improvement i am face same problem. I am also check this link click add fragment then facing this problem. but replace fragment then not facing this problem more add fragment then RecyclerView lagging. i think fragment memory issue Every time user click see all related

ViewPager with two tabs causes IndexOutOfBoundsException when sliding and clicking

放肆的年华 提交于 2020-04-03 10:41:05
问题 I have two tabs in which I add two different lists of data, both tabs share a single recyclerview, so at my viewpager adapter, I just create a new instance to populate the data From the View val allProducts = completeProductList val productsList = mutableListOf<Products>() val drinksList = mutableListOf<Products>() for (product in allProducts) { if (product.isDrink) { drinksList.add(product) } else { productsList.add(product) } } viewPagerAdapter.productsList = productsList viewPagerAdapter

Databinding Recyclerview and onClick

Deadly 提交于 2020-03-26 03:19:26
问题 Ok I'll try one more time. Last time I asked about passing data between recyclerview and item and one person helped me with open item by click, but I still don't have idea how to show the data of clicked item in new activity. I want to click on an item and then display the data of that item in new activity. In this activity I want to edit data. Does anyone knows how to do it? I need any idea. RecyclerView Adapter with OnItemClickListener interface: public class RecyclerViewAdapter extends

Android Studio Preview Not Showing RecyclerView and Toolbar Correctly

久未见 提交于 2020-03-25 22:39:03
问题 Please find the screenshots I searched lot for this. My android studio is updated with 3.0.1. Here are the dependencies in my project. Is the issue with studio 3.0.1? compile 'com.android.support:appcompat-v7:23.4.+' compile 'com.android.support:design:23.3.0'` Here is the xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">

Android Studio Preview Not Showing RecyclerView and Toolbar Correctly

孤者浪人 提交于 2020-03-25 22:35:20
问题 Please find the screenshots I searched lot for this. My android studio is updated with 3.0.1. Here are the dependencies in my project. Is the issue with studio 3.0.1? compile 'com.android.support:appcompat-v7:23.4.+' compile 'com.android.support:design:23.3.0'` Here is the xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">

Recycler View with GridLayoutManager not scrolling

北城以北 提交于 2020-03-24 03:30:32
问题 The app contains two buttons, one for ListView and other for GridView, so I created to ItemViews and one adapter. I have created method, to switch between ListView and GridView. Every thing is working fine, except the GridView, which seems like it is jammed. List View is scrolling vertically but only upto 6 items, the list contains 9. I want the GridView to scroll in same fashion as List View scrolls until end. I have spent 2 simultaneous hours for searching solution, but none has worked. I