android-recyclerview

How to multi-select using drag gesture in RecyclerView ?

社会主义新天地 提交于 2019-12-23 19:17:13
问题 This is a very short question: Recently Google has updated its material design guidelines, showing that multi selection of items should be like on the Google-Photos app (here), as such: I've noticed that even if you are already in multi-selection mode, you can still use this gesture anywhere you wish. What I did so far is handling clicking of items for multi-selecting them, but how do I do what Google has shown? 回答1: Although it's complicated and there are some libraries to use, it will be

Android: RecyclerView item Contextmenu issue

柔情痞子 提交于 2019-12-23 19:12:19
问题 I am trying to implement a RecyclerView, that each item when clicked, a context menu will pop up. I have referred the answers/comments from this question on how to to do what I wanted. My problem is, I keep getting null by using getMenuInfo() to retrieve info. Ie, When I select an item from the context menu, this is what I get java.lang.NullPointerException: Attempt to read from field 'long com.x.lib.RVCoursesContextMenu$RecyclerContextMenuInfo.id' on a null object reference My code for this

RecyclerView programmatically click

自闭症网瘾萝莉.ら 提交于 2019-12-23 17:11:01
问题 I'm trying to programmatically click on an item of a recyclerView. I'm using: recyclerView.findViewHolderForAdapterPosition(index).itemView.performClick(); This perfectly works when the index is of a visible item. If the item is not visible (at the last position of the recyclerview, for istance), an Exception is thrown. What can I do? 回答1: You could call onClick directly, assuming that view manages its own click listener. View view = recyclerView.findViewHolderForAdapterPosition(index)

Android - RecyclerView with various dynamic content, different for each item

拟墨画扇 提交于 2019-12-23 17:10:31
问题 I have some json collection got from rest api, it defines various parameter types, like: spinner with values collection (of string or some class objects with some fields) date time field with date value text edit field set of check boxes (check box defined by id, name - caption, state checked/unchecked) set of radio buttons Each parameter is also named. What I need: visualise list of items (each item will be one from types described above), let user to adjust values for each of them, retrieve

Using Switch in RecyclerView srcoll

Deadly 提交于 2019-12-23 16:28:06
问题 I have use the Switch in the RecyclerView . It have facing the issue of recycling behaviour. When I switch on the 1st position ,it automatically on the switch at 10 postion ... I think it due to reuse of the view. How to fix it. find the screenshot: https://www.dropbox.com/s/4ms2jf9e28fyc7u/error.png?dl=0 private void setAdapter(ArrayList data) { ManageCategoryAdapter adapter = new ManageCategoryAdapter(data); adapter.SetOnItemClickListener(listClick); mRecyclerView.setAdapter(adapter); }

RecycleView's span size

白昼怎懂夜的黑 提交于 2019-12-23 15:50:42
问题 I'm trying to achieve a layout similar to the picture above with the RecyclerView in conjunction with the GridLayoutManager, i tried setting the setSpanSizeLookup based on position but couldn't mimic the design above.. anyone could help please? mRecyclerView = (RecyclerView) contentView; mRecyclerView.setHasFixedSize(false); GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 3); gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override

Is it possible to set gravity programmatically for RecyclerView children in Android?

≡放荡痞女 提交于 2019-12-23 15:18:43
问题 I'm trying to set gravity for children in RecyclerView, but it looks like the LayoutParams does not have a gravity method. I have tried the following: RecyclerView.LayoutParams params = new RecyclerView.LayoutParams( RecyclerView.LayoutParams.WRAP_CONTENT, RecyclerView.LayoutParams.WRAP_CONTENT); I have also tried the following: RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); In both

How to highlight the first row of RecyclerView by default and then remove highlight as and when other rows are selected?

放肆的年华 提交于 2019-12-23 15:03:39
问题 I am trying to load a list in RecyclerView and show the first row of the list as selected. I have achieved it using the following code: @Override public void onBindViewHolder(NavigationDrawerAdapter.ViewHolder holder, final int position) { if (!mNavClassrooms.get(position).equals("")) { holder.mTextViewClassroom.setText(mNavClassrooms.get(position)); // Setting the Text with the array of our Titles holder.mRelLayClassroom.setSelected(mSelectedItems.get(position, false)); /* The following code

RuntimeException: view tag isn't correct on view:null on ViewAgendaItemBinding.bind() method

半世苍凉 提交于 2019-12-23 14:21:39
问题 I have pretty simple code which should be working according several articles regarding DataBinding but for some reason it's not. I'm trying to use RecycleView together with Databinding. class ItemViewHolder extends RecyclerView.ViewHolder{ ViewAgendaItemBinding binding; public ItemViewHolder(View itemView) { super(itemView); binding = ViewAgendaItemBinding.bind(itemView); //this is line where it's throw an error. } } I checked generated version of this bind method and it's looks like that:

How do I not recycle only the first 2 views of my recyclerview or any items?

冷暖自知 提交于 2019-12-23 13:06:42
问题 I am using a recyclerview for displaying and broadcasting videos of users. However, when I scroll through the recycler view, I see my first view, which has my video gets recycled hence why it's not visible to other users. Is there a way I can make sure that the first view is not recycled so I dont have to worry about my video view getting resetrecycled every single time I scroll through my list? Here's my code : In my fragment... ... <android.support.v7.widget.RecyclerView android:id="@+id