android-recyclerview

Set span for items in GridLayoutManager using SpanSizeLookup

不羁岁月 提交于 2019-12-17 04:46:52
问题 I want to implement grid-like layout with section headers. Think of https://github.com/TonicArtos/StickyGridHeaders What I do now: mRecyclerView = (RecyclerView) view.findViewById(R.id.grid); mLayoutManager = new GridLayoutManager(getActivity(), 2); mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch(mAdapter.getItemViewType(position)){ case MyAdapter.TYPE_HEADER: return 1; case MyAdapter.TYPE_ITEM: return 2;

How can I validate recyclerview adapter TextInputEditText from fragment?

只愿长相守 提交于 2019-12-17 04:36:41
问题 I have a fragment, which contains a recyclerview. This recyclerview is managed with an adapter that includes the viewholder pattern. In the fragment I have a "Save" button, this button must check that no TextInputEditText is empty in the list. The problem is that I can not access the TextInputEditText of the adapter. ViewHolder is only accessible from the "onBindViewHolder" method. I tried to access from fragment in a way: for (int i = 0; i < employeeList.size(); i++) { View employeeView =

Is there a way to paginate queries by combining query cursors using FirestoreRecyclerAdapter?

ⅰ亾dé卋堺 提交于 2019-12-17 04:34:19
问题 I have a query that looks like this: Query first = ref.orderBy("name", Query.Direction.ASCENDING).limit(10); This is how I display the data to my RecyclerView . firestoreRecyclerOptions = new FirestoreRecyclerOptions.Builder<ModelClass>().setQuery(query, ModelClass.class).build(); myFirestoreRecyclerAdapter = new MyFirestoreRecyclerAdapter(firestoreRecyclerOptions); recyclerView.setAdapter(myFirestoreRecyclerAdapter); I'm trying to use pagination as specified in here and I cannot solve it.

Adding items to Endless Scroll RecyclerView with ProgressBar at bottom

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 03:51:04
问题 I followed Vilen's excellent answer on SO: Put an indeterminate progressbar as footer in a RecyclerView grid on how to implement an endless scroll recyclerview with ProgressBar. I implemented it myself and it works but I would like to extend the example. I want to add extra items at the top of the recyclerview, similar to how Facebook does it when you add a new status update. I was not able to add extra items onto the list successfully - here is my code that I added onto Vilen's code in his

Adding items to Endless Scroll RecyclerView with ProgressBar at bottom

倖福魔咒の 提交于 2019-12-17 03:51:00
问题 I followed Vilen's excellent answer on SO: Put an indeterminate progressbar as footer in a RecyclerView grid on how to implement an endless scroll recyclerview with ProgressBar. I implemented it myself and it works but I would like to extend the example. I want to add extra items at the top of the recyclerview, similar to how Facebook does it when you add a new status update. I was not able to add extra items onto the list successfully - here is my code that I added onto Vilen's code in his

Swipe to Dismiss for RecyclerView [closed]

不羁岁月 提交于 2019-12-17 03:21:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I used to SwipeToDismiss library but now I'm trying to migrate to RecyclerView and things are not so obvious, do you know any replacements for this lib? Any ideas how to implement it from the scratch? 回答1: As of v22.2.0, the Android support team has included an ItemTouchHelper class that makes swipe-to-dismiss and

Saving EditText content in RecyclerView

隐身守侯 提交于 2019-12-17 01:41:07
问题 I have list item with EditText in it, I don't know how many items there will be. I have a problem when I enter some text in EditText , and then scroll down a RecyclerView , after I've scroll up again there is no text in my first EditText . I am wondering what, and where should I write code so that while the user is typing or finished typing (I was thinking to do that with a TextWatcher ) in the EditText the text gets saved into into a file (I'll save it in a .txt file in the external storage)

How to properly highlight selected item on RecyclerView?

 ̄綄美尐妖づ 提交于 2019-12-17 01:35:44
问题 I am trying to use a RecyclerView as a horizontal ListView . I am trying to figure out how to highlight the selected item. When I click on one of the items, it gets selected and it is highlighted properly but when I click on another one, the second one gets highlighted with the older one. Here is my onClick function: @Override public void onClick(View view) { if(selectedListItem!=null){ Log.d(TAG, "selectedListItem " + getPosition() + " " + item); selectedListItem.setBackgroundColor(Color.RED

Recyclerview and handling different type of row inflation

跟風遠走 提交于 2019-12-16 20:06:18
问题 I'm trying to work with the new RecyclerView , but I could not find an example of a RecyclerView with different types of rows/cardviews getting inflated. With ListView I override the getViewTypeCount and getItemViewType , for handling different types of rows. Am I supposed to do it like the "old" way or should I do something with LayoutManager ? I was wondering if someone could point me to the right direction. Because I can only find examples with one type. I want to have a list of slightly

How to build a Horizontal ListView with RecyclerView?

99封情书 提交于 2019-12-16 19:52:41
问题 I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android? however, these questions were asked before Recyclerview was released. Is there a better way to implement this now with Recyclerview? 回答1: Is there a better way to implement this now with Recyclerview now? Yes. When you use a RecyclerView , you need to specify a LayoutManager that is responsible for