android-recyclerview

RecyclerView with wrap content items

心已入冬 提交于 2019-12-10 17:34:44
问题 I need to implement next UI element: Unknown size list of strings (That came from a server call) Any item should be wrap content. If an item is not fits to row, he will be in the next row. All list/grid is centered I thought of using RecyclerView with StaggeredGridLayoutManager But I don't know if it the right way, any ideas? 回答1: I don't sure that method would be helpful for you, but instead of using RecyclerView with StaggeredGridLayoutManager you can use third-party FlowLayout : First

notifyItemInserted() in RecyclerView and animation

空扰寡人 提交于 2019-12-10 17:16:42
问题 When I'm adding a new item, I'm calling method public void addItem(ArrayList<ArrayList<String>> arrayList, int position){ this.arrayList=arrayList; notifyItemInserted(position); } and expect to see added item animated, but only previous item in recyclerView can be animated. I tried to change position like (position+1) or (position-1), but it doesn't help. Activity's code: private void showDialog(final String table_name) { ... final Cursor c = db.rawQuery("SELECT * FROM '"+table_name+"'",null)

How to get recyclerview image data in mainactivity

岁酱吖の 提交于 2019-12-10 17:01:19
问题 What i am trying to do is getting images from gallery and camera and placing it in an recyclerview. Now main parts comes after image is now placedd in the recyclerview , but can anyone just tell me how can i get back these images shown in the recyclerview back to the mainActivity only when i click my upload button. Thank you in advance. My Main Activity. package www.welkinfort.com.pphc; import android.app.DatePickerDialog; import android.content.Intent; import android.database.Cursor; import

Android Why use executePendingBindings in RecyclerView

假装没事ソ 提交于 2019-12-10 16:46:59
问题 I have been using lately data bindings and i came across the executePendingBindings method. The documentation shows little much about it and i can't understand how it works or when to use it. A lot of developers use the executePendingBindings inside the onBindViewHolder callback but i don't see any differences myself in recycler when using it or not. Can someone explain why its important to use in recycler?? Thanks @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder,

RecyclerView doesn't show items until scrolling

家住魔仙堡 提交于 2019-12-10 16:44:37
问题 This question has been asked a few times but those answers doesn't apply to me. I would like a more general answer about what causes this issue generally. I have a recyclerview in my activity layout. Rows of the recyclerview is a constraint layout with one imageview and textview: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width=

IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

北战南征 提交于 2019-12-10 16:35:12
问题 I am trying to remove an item from my RecyclerView , but I always get an error. java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling I am using notifyDataSetChanged() . How can I solve this? Here is my adapter code public class ListAdapters extends RecyclerView.Adapter<ListAdapters.MyViewHolder> { public ArrayList<String> tvdatalist; Context c; int pos; ListAdapters.MyViewHolder myViewHolder; private LayoutInflater layoutInflater; int[

How do I decrease the space between cards in a CardView within a RecyclerView?

牧云@^-^@ 提交于 2019-12-10 16:22:58
问题 I'm working on a layout for the main screen of my app. I'm using a RecyclerView with a grid layout and a CardView within that. I'm trying to decrease the space between each card. A screenshot is below (with layout outlines turned on) as well as my layout files. How can I get each card to be a bit closer to each other vertically as well as horizontally? I've been playing around with margins a lot and I just can't seem to find the right margin or padding value to do this. Thanks for any help!

Android. Search and filter in the RecyclerView

微笑、不失礼 提交于 2019-12-10 16:19:52
问题 translated using "google translate"! Briefly about the problem. I decided to try to use RecyclerView. Ready solutions like search listView, there is no need to implement all. So I found a solution, if one is needed at the bottom of the source code, but there is a problem. There is a list, it displays headlines, when you click on any item in the second turn Activiti which already has a title and a full description. Realized I like: In MainActivity I load from the database (using Sugar ORM)

How to create leaning list items

旧时模样 提交于 2019-12-10 16:16:48
问题 I have a horizontal RecyclerView which looks like this (obviously) ------------------------------- | | | | | | | 1 | 2 | 3 | 4 | 5 | | | | | | | ------------------------------- I want to do this: ------------------------------ | / / / / | | 1 / 2 / 3 / 4 / 5 | | / / / / | ------------------------------- What is the best way to create a RecyclerView like this? Note: I'm not trying to create a leaning divider. I am trying to create a leaning layout. By leaning I mean masked not rotated. Items

Android Google Maps dynamic fragment in RecyclerView holder

筅森魡賤 提交于 2019-12-10 16:16:44
问题 I'm trying to add Google Maps fragments into a RecyclerView in Android. I was reading about it and I saw that I need to create the fragments dynamically instead of doing it by XML to avoid the duplicate ID errors. Here is my adapter code : public class MapViewHolder extends RecyclerView.ViewHolder { protected FrameLayout mapContainer; public MapViewHolder(View v){ super(v); view = v; mapContainer = (FrameLayout) v.findViewById(R.id.mapContainer); } } private void bindMapRow(final