android-recyclerview

how to use paging when recyclerview item have another recyclerview

自古美人都是妖i 提交于 2021-01-29 10:54:11
问题 i have a recyclerview item ,it contains an another recyclerview to show image list: <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/imageRv" android:layout_width="0dp" android:layout_height="wrap_content" /> if i use paging in ViewHolder,i have to invoke like this class GankViewHolder(parent: View) :

How do I change the background of a specific item onClick in a RecyclerView?

喜你入骨 提交于 2021-01-29 10:18:22
问题 Im trying to make a selected item in the RecyclerView to change it's background when it is clicked, but once the other item in the RecyclerView is clicked, that item's background will be changed and the previously clicked item will change back to original. I only manage to make the item change back to orignal(white background) when it is clicked the second time. Any help please? This is my RecyclerView Adapter public class CharityListAdapter extends RecyclerView.Adapter<CharityListAdapter

print the value selected in recycleview kivy

≯℡__Kan透↙ 提交于 2021-01-29 09:16:17
问题 I have a problem, when pressing on the list of the recyclerview i print the number of the index but i need print the value in the index code in below please any one can help me class SecondWindow(BoxLayout,Screen): myresult = ListProperty([("N_matricule", "Operateur")]) def insert_part(self): partnum = self.ids.Part_field part = partnum.text mycursor.execute( """SELECT OPERATION_DESCRIPTION FROM liste_des_operations WHERE PART_NO = %s""", (part,)) self.myresult = mycursor.fetchall() #for row

scroll recyclerview item to top inside of scroll view

扶醉桌前 提交于 2021-01-29 09:09:56
问题 I'm trying to scroll recycler view item to top of screen when user clicks on an item. My layout is set as following - <FrameLayout> -- <ScrollView> --- <LinearLayout /> // static content --- <RecyclerView /> // dynamic content --- <LinearLayout /> // static content -- </ScrollView> -- </FrameLayout> What I want to achieve is when i click on an item of recyclerview. It should scroll up to top of the screen. I have tried following so far but no luck. -> // use recycler view's layout manager to

Accessing dynamically to a Kotlin class property

可紊 提交于 2021-01-29 07:25:54
问题 I want to set dynamically a backgroundColor to a text view in a RecyleView, and thus not all my item will have the same background color for their tag. This is the pseudo code I'd like to use : val name = item.type.toLowerCase() color = ContextCompat(item.context, R.color[name]) But this syntax does not seem to work in Kotlin, and I really have no idea how to fetch the color value from the resource depending on the type of the item. I also tried this: val lowerType = pokemon.type.toLowerCase(

Infinite Progress bar using JSON and Recycler view Android?

一个人想着一个人 提交于 2021-01-29 07:06:33
问题 I want implement load more progress bar after 10 image or position in my recycler-view. Here is some screenshot which give you more ideas I am fetching data from JSON. Here is example of my code [{ "name": "Thick Wallpaper", "url":{ "small": "https://i.pinimg.com/originals/b1/99/57/b19957de05529750cf4d8270441d5f95.jpg", "medium": "https://i.pinimg.com/originals/b1/99/57/b19957de05529750cf4d8270441d5f95.jpg", "large": "https://i.pinimg.com/originals/b1/99/57/b19957de05529750cf4d8270441d5f95

Grid Layout in Recycler view is cutting of the first two items

家住魔仙堡 提交于 2021-01-29 06:08:42
问题 I am using a Recycler view that hold a Grid Layout to present the items in a 2 by 2 way. The problem is that the first two items are not stretching accordingly with the content inside. To easy the explanation here is one example of my problem: Regarding the code, in my item.xml I have <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/cardView"

RecyclerView doesn't show up in Android Studio Preview

允我心安 提交于 2021-01-29 06:08:33
问题 This is what I am getting when I add a recyclerView in my layout.(I already imported the dependency) My Layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> This is when I set height and width to wrap content: Here I

In Android Kotlin, what's the right way to pass a onclick event into a viewholder?

感情迁移 提交于 2021-01-29 06:00:41
问题 Is there any difference in these two ways? I've been using the seond way and it works so far, yet I found the first way upon reading tutorial articles. 1st: class FlowersAdapter(private val onClick: (Flower) -> Unit) : ListAdapter<Flower, FlowersAdapter.FlowerViewHolder>(FlowerDiffCallback) { /* ViewHolder for Flower, takes in the inflated view and the onClick behavior. */ class FlowerViewHolder(itemView: View, val onClick: (Flower) -> Unit) : RecyclerView.ViewHolder(itemView) { private val

RecyclerView Adapter: why does onLongClick method conflict with onClick?

。_饼干妹妹 提交于 2021-01-29 05:46:56
问题 In my RecyclerView's adapter file I have an OnClickListener set in the onCreateViewHolder method. It is working correctly, which is to launch a new activity when an item in the RecyclerView list is clicked on. I am trying to add an OnLongClickListener for a LongClick on the item that will run a different method. When I add the setOnLongClickListener section and onLongClick method shown below, then the items in the RecyclerView list don't show properly so something with the views must not be