android-recyclerview

RecyclerView does not update after removing an item [duplicate]

谁说我不能喝 提交于 2021-02-20 09:08:19
问题 This question already has answers here : How to update RecyclerView Adapter Data? (13 answers) Closed yesterday . I have a RecyclerView horizontal image slider at the bottom of a fragment. The top of the fragment shows some details. Once the user clicks on the images at the bottom, the idea is to remove that image from the image slider and display its information in the fragment. Now the information shows up but the image does not gets removed from the RecyclerView . Here is what I have coded

RecyclerView does not update after removing an item [duplicate]

徘徊边缘 提交于 2021-02-20 09:07:13
问题 This question already has answers here : How to update RecyclerView Adapter Data? (13 answers) Closed yesterday . I have a RecyclerView horizontal image slider at the bottom of a fragment. The top of the fragment shows some details. Once the user clicks on the images at the bottom, the idea is to remove that image from the image slider and display its information in the fragment. Now the information shows up but the image does not gets removed from the RecyclerView . Here is what I have coded

RecyclerView does not update after removing an item [duplicate]

狂风中的少年 提交于 2021-02-20 09:07:07
问题 This question already has answers here : How to update RecyclerView Adapter Data? (13 answers) Closed yesterday . I have a RecyclerView horizontal image slider at the bottom of a fragment. The top of the fragment shows some details. Once the user clicks on the images at the bottom, the idea is to remove that image from the image slider and display its information in the fragment. Now the information shows up but the image does not gets removed from the RecyclerView . Here is what I have coded

RecyclerView ItemDecoration - How to draw a different width divider for every viewHolder?

拟墨画扇 提交于 2021-02-19 06:00:29
问题 Currently my divider is only drawing one width: How would can I add an extra divider for every increment position in my recyclerview? Here is my ItemDecoration class: public SimpleDivider(Context mContext, ArrayList<Integer> mDepth) { mDivider = ContextCompat.getDrawable(mContext, R.drawable.recycler_view_divider); this.mContext = mContext; this.mDepth = mDepth; dividerMargin = 15; } @Override public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State

save state of an item in recyclerview when scrolled out of the view

夙愿已清 提交于 2021-02-19 03:40:13
问题 In my project i have a recyclerView which contains at most 20 items. In the row template i have a text view and a button which is hidden initially and on the recyclerview item click the visibility of the button is toogled. The problem is when the button in the first row is shown and if it is scrolled out of the view and then scrolled back the button is invisible again without calling toogle visibility.How can i save the sate of objects in recycler view when it is scrolled out of the view 回答1:

RecyclerView notifyItemInserted() Animation not showing when position is 0 but works fine with other position

孤者浪人 提交于 2021-02-19 02:19:06
问题 I am using data.add(0,item); notifyItemInserted(0); This works fine as long as the items space is not filled up. After that, animation is not seen. animation works fine when i do data.add(1,item); notifyItemInserted(1); How to add items in 0 position and show animation all the time. Do I have to use scrollToPosition? 回答1: call scrollToPosition(0) if you wan't it to scroll to position 0 after new item is added. RecyclerView will just keep the current top item in place, which is why you are not

RecyclerView behavior - Goes empty when keyboard is opened/closed

给你一囗甜甜゛ 提交于 2021-02-18 21:53:32
问题 I have implemented a RecyclerView with SearchView and Filterable ; all classes from v7 . Now there is this behavior that is annoying. Whenever the keyboard is brought up or closed the contents of the RecyclerView goes blank. The count is still correct but the view is empty. My guess, it has something to do with the Layout size change. Is this behavior normal or something is wrong? How to deal with it? I can show the code but don't quite know which part will be relevant so tell me what can I

Showing Folder with Video File in RecyclerView

*爱你&永不变心* 提交于 2021-02-18 12:20:14
问题 I am listing all my media files in a recycler view. Suppose a media file is in a folder, then I want to show that folder in my recycler view too. Here is my code to list media files var projection = arrayOf(MediaStore.Video.Media.DISPLAY_NAME) var cursor = CursorLoader(applicationContext, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null).loadInBackground() if (cursor != null) { while (cursor.moveToNext()) { val name = cursor.getString(cursor.getColumnIndex(MediaStore

Showing Folder with Video File in RecyclerView

房东的猫 提交于 2021-02-18 12:20:10
问题 I am listing all my media files in a recycler view. Suppose a media file is in a folder, then I want to show that folder in my recycler view too. Here is my code to list media files var projection = arrayOf(MediaStore.Video.Media.DISPLAY_NAME) var cursor = CursorLoader(applicationContext, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null).loadInBackground() if (cursor != null) { while (cursor.moveToNext()) { val name = cursor.getString(cursor.getColumnIndex(MediaStore

RecyclerView, StaggeredGridLayoutManager Refresh Bug

核能气质少年 提交于 2021-02-18 04:50:34
问题 I used support library v7-21 and the RecyclerView isn't showing correctly. GridLayoutManager and LinearLayoutManager is Ok. Problem only occurs when in StaggeredGridLayoutManager I Load my DataSet and then refresh the data. Data refresh is working fine but the RecyclerView 's view exist out of the screen. does anyone knows how to fix it? 回答1: Updated 2015-01-04 (at bottom) I have an example project to demonstrate this at https://github.com/dbleicher/recyclerview-grid-quickreturn . But here