android-recyclerview

Why are my “posts” loading in different sizes in android recyclerview?

懵懂的女人 提交于 2019-12-20 04:12:45
问题 Okay, this is how my recyclerview is showing my "posts". Can anyone tell me why? I will post source code as well. I have tried changing some of the code with no success. Also, when I scroll through my RecyclerView, some of them resize to smaller or larger sizes. Any and all help is appreciated! fragment_home.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"

RecyclerView doesn't load data in first launch using FirebaseRecyclerAdapter

为君一笑 提交于 2019-12-20 03:33:15
问题 I'm using FirebaseRecyclerAdapter to populate a RecyclerView in a Fragment . Here's my code mDatabase = FirebaseDatabase.getInstance().getReference(); myAdapter = new FirebaseRecyclerAdapter<Product, ProductViewHolder>(Product.class, R.layout.product_item,ProductViewHolder.class, mDatabase.child("clothes")) { @Override protected void populateViewHolder(ProductViewHolder viewHolder, Product model, int position) { mProgressBar.setVisibility(ProgressBar.INVISIBLE); viewHolder.name.setText(model

SwipeRefreshLayout blocking horizontally scrolled RecyclerView

你。 提交于 2019-12-20 02:41:15
问题 My setup is simple enough: <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="220dp"/> </android.support.v4.widget.SwipeRefreshLayout> The content of onCreate() : layoutManager = new LinearLayoutManager( this ); layoutManager.setOrientation( LinearLayoutManager

How to Change the viewType of a RecyclerView item onClick

蹲街弑〆低调 提交于 2019-12-19 16:34:09
问题 I have created a RecyclerView with Cards as its primary viewtype. What I am trying to achieve is that when user clicks on a item the ViewType of that item is changed from cards to another Viewtype(for example a list textviews placed horizontally scrollable). My code for RecyclerView Adapter is as follows : In the below piece of code I have created a arrraylist of enum types to keep track of the clicked state of each row in recyclerview, then I got the size of my dataset and initialized my

How to Change the viewType of a RecyclerView item onClick

余生长醉 提交于 2019-12-19 16:33:22
问题 I have created a RecyclerView with Cards as its primary viewtype. What I am trying to achieve is that when user clicks on a item the ViewType of that item is changed from cards to another Viewtype(for example a list textviews placed horizontally scrollable). My code for RecyclerView Adapter is as follows : In the below piece of code I have created a arrraylist of enum types to keep track of the clicked state of each row in recyclerview, then I got the size of my dataset and initialized my

How to obtain multiple Checkbox states from nested Recycler View?

[亡魂溺海] 提交于 2019-12-19 11:24:26
问题 I have multiple checkboxes (switches in my case), in a nested recycler view. It looks like the following : I want to be able to retrieve all switch states on this screen when the user goes back and be able to identify which one’s are set to true. For example, I’m looking to obtain something in a similar format to this: [Item 0, Sub Item 1, TRUE], [Item 0, Sub Item 2, TRUE], [Item 1, Sub Item 0, TRUE] , etc. My issue is that I’m not exactly sure how to store these switch states. I'm not sure

Run media file in CardView layout

╄→гoц情女王★ 提交于 2019-12-19 11:24:03
问题 Is there a way to have a media file ( audio/video ) running in a cardview layout? I want to have a video preview of the file inside a card layout , when the user clicks on the card the video/audio is taken fullscreen and played, just like Facebook's feed. 回答1: In order to get that kind of functionality you have to solve a few problems: You cannot use VideoView in a list because it is extending SurfaceView , and if playback is on and user starts scrolling, the visual effect will look like

Null pointer exception when trying to programmatically perform click on non visible Recycler view item

旧时模样 提交于 2019-12-19 10:38:09
问题 I have a recycler view and I want to perform click on one of its items. Here is my code: mRecyclerView.findViewHolderForAdapterPosition(2).itemView.performClick(); It works fine when the item is visible, but when it is not visible i'm getting a null pointer exception also i tried scroll to position before perform click but i got same result Any idea on how to solve this issue? 回答1: I have solved my problem with this code mRecyclerView.getLayoutManager().scrollToPosition(17); search_list

MultichoiceModeListener on RecyclerView android

一世执手 提交于 2019-12-19 10:28:13
问题 I have a recyclerview with respective adapter. I want to show multiple customview menu options in toolbar on the long press of recyclerview item. Any help is highly appreciated. Thanks in advance. 回答1: I'm doing the same work. This post is helpful: RecyclerView with choice modes Basically you have to add this code in your OnLongClick method @Override public boolean onLongClick(View view) { if (!mMultiSelector.isSelectable()) { ((AppCompatActivity) getActivity()).startSupportActionMode

Android RecyclerView strange endAllStagingAnimators error

余生颓废 提交于 2019-12-19 10:22:01
问题 I have very strange problem with displaying item in RecyclerView . first of all it does not display items (strange D/OpenGLRenderer: endAllStagingAnimators on 0x6dd9c400 (CardView) with handle 0x6861d090 appears - never happened before) and back button does not work (it appears but does not react). Ok lets start. I have some Fragment (here is that fragment with RecyclerView : I also have 1 identical fragment to that but one of them conatins as you can see kitchen types and second one has meal