android-recyclerview

RecyclerView.Adapter.notifyItemMoved(0,1) scrolls screen

Deadly 提交于 2019-12-08 22:25:59
问题 I have a RecyclerView managed by a LinearlayoutManager, if I swap item 1 with 0 and then call mAdapter.notifyItemMoved(0,1), the moving animation causes the screen to scroll. How can I prevent it? 回答1: Call scrollToPosition(0) after moving items. Unfortunately, i assume, LinearLayoutManager tries to keep first item stable, which moves so it moves the list with it. 回答2: Sadly the workaround presented by yigit scrolls the RecyclerView to the top. This is the best workaround I found till now: //

Scrollbar on Top Side in Horizontal RecyclerView

最后都变了- 提交于 2019-12-08 20:41:59
问题 I am working on the Simple demo of Horizontal RecyclerView . I want to display scrollbar along with the recyclerview. So I have added android:scrollbars="horizontal" and android:scrollbarSize="5dp" in XML. I am able to get the Scrollbar but it is showing on the bottom. What I want to achieve is to show it on Top. I have found some questions like this but none of them are for horizontal recyclerView + top side scrollbar. Here is the code which I have tried so far: <android.support.v7.widget

Setting image resourse by obtaining tag position for an imageview android

霸气de小男生 提交于 2019-12-08 19:55:29
I am making use of recycler view. I have a layout that is highlighted in light red,this layout is included for each item in the recycler view. The light red layout is placed over the background image. I am using setTag method to identify the clicks of the buttons in red layout. That is working properly when i click i get the position. The problem is i want to change the image at specific position. For example : Consider the heart button. I have set a tag on it like this. heartButton = findViewById(id); heartButton.setTag(position); now i get the position by using the getTag method. But now i

how to pass Position wise object data one activity to another using recyclerview and databse in android

。_饼干妹妹 提交于 2019-12-08 19:42:32
I have create the recycerview and this recycerview display the Person image ,person name and + button when i have press + button change the button image like true.and after recycerview bottom one button this button click all data show the next activity.. My Adapter public class BuildCustomAdapter extends RecyclerView.Adapter<BuildCustomAdapter.MyViewHolder> implements Filterable { private List<People> peopleList; private List<People> peopleListCopy; private ItemFilter mFilter = new ItemFilter(); public BuildCustomAdapter(List<People> buildList) { this.peopleList = buildList; this

retain ripple effect during notifydatachanged in recyclerview

六月ゝ 毕业季﹏ 提交于 2019-12-08 16:27:07
问题 I am started to modify my application to support lollipop. Basically, I have a file browser fragment with recyclerview, When the user opens this fragment he will see all the folders on his root directory, when the user will click on the folder I need to get all the subfolders + files and show them to the user using the same recyclerview with notifydatachanged. The functionality working properly the problem is when the user clicks a folder the ripple effect is not retained during

Vertically center selected item in RecyclerView

ぐ巨炮叔叔 提交于 2019-12-08 16:01:21
问题 I'm trying to implement some kind of wheel picker for my app, because the current options rely on custom Views or the old ListView , so I'd like to base my solution on RecyclerView . What I did until now was to set at the beginning and at the end of the RecyclerView two View with a different type, named PADDING_TYPE so that the first and the last item are vertically centered in the RecyclerView . recyclerView.post(new Runnable() { @Override public void run() { //80dp is the height of a

What is the difference between swapadapter method and notifydatasetchanged method in Recycler view?

时光毁灭记忆、已成空白 提交于 2019-12-08 15:57:57
问题 I would like to know what exactly is the difference between swapAdapter and notifyDatasetChanged methods of RecylerView? Which one is better to use while modifying the data? 回答1: As the Documentation reads. public void swapAdapter (Adapter adapter, boolean removeAndRecycleExistingViews) Swaps the current adapter with the provided one. It is similar to setAdapter(Adapter) but assumes existing adapter and the new adapter uses the same RecyclerView.ViewHolder and does not clear the

Regarding ProperScrolling in Horizontal Recycler View

橙三吉。 提交于 2019-12-08 15:51:45
问题 I have issues scrolling in horizontal recycler view.For eg if i have 10 items,very first time,I am able to scroll till last item,But if i go to first item and then scroll again to last item,it is not moving to last item. Is this issue related to scrolling,Should i override for scrolling,if that's case. This is my fragment class declaration LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); mRecyclerView = (RecyclerView)v.

RecyclerView - How highlight central visible item during scroll

纵然是瞬间 提交于 2019-12-08 15:49:46
问题 I need a RecyclerView like this: It should does: show 7 items per time ( DONE ) center the RecyclerView on the central visible item ( DONE ) when I scroll to right/left, the central item will be "highlighted" (the button is selected > blue color) ( need HELP ) when I click on a button, it will be centered with a smooth scrool ( need HELP ) I used SnapHelper class to center the RecyclerView on the central items (I retrieve the central visible item getting the nearest child to the screen center

Drag View and Drop it on RecyclerView item Android

岁酱吖の 提交于 2019-12-08 15:45:32
问题 I am developing an android application that has a screen contains the following: Recycler view that contains categories as the below figure Separate view at the botton and the user should able to drag it on a RecyclerView item, and after drop the user will show changing at the RecyclerView item data (for example items count at the category) I need some help about how to implement this process to drag View into Recycler item, the following figure explains exactly what I want to do but have no