recycler-adapter

Click through a RecyclerView list item

a 夏天 提交于 2019-11-30 19:29:15
I have a RecyclerView with a LinearLayoutManager and an Adapter : @Override public int getItemViewType(int position) { return position == 0? R.layout.header : R.layout.item; } Here's header.xml : <View xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/header" android:layout_width="match_parent" android:layout_height="@dimen/header_height" /> What I want to achieve is to have a hole in the RecyclerView where I can click through to anything behind the RecyclerView . I tried a lot of combinations the following attributes to no avail: android:background="@android:color

How to implement load more recyclerview in android

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 13:07:15
I want to implement load more in Recyclerview. Here is the code. The code is from github. https://gist.github.com/ssinss/e06f12ef66c51252563e MainActivity code: package com.example.tatson.bila; import android.app.ProgressDialog; import android.os.AsyncTask; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView;

when does getItemCount() method get called in RecycleView adapter?

天涯浪子 提交于 2019-11-30 12:00:43
I have a adapter which populates data to RecyclerView . I am not calling notifyDataSetChanged() and I am setting the adapter to the RecyclerView in onCreateView() (so in getItemCount() should be called once) in Fragment but I find getItemCount() called multiple times. 来源: https://stackoverflow.com/questions/31748131/when-does-getitemcount-method-get-called-in-recycleview-adapter

ListView.getItemAtPosition(i) equivalent in RecyclerView?

有些话、适合烂在心里 提交于 2019-11-30 08:53:05
问题 I'm migrating from a ListView backed by a CursorAdapter, to a RecyclerView backed by shywim's CursorRecyclerAdapter. I'm having trouble migrating this part that used to return a cursor object: (MyCursor)mListView.getItemAtPosition(i) How to get access to cursor at specific position inside RecyclerView? Thanks. 回答1: Unfortunately it is not part of the RecyclerView. To overcome it I define an interface: public interface OnItemClickListener { public void onItemClick(View view, int position); }

RecyclerView onItemClick Listener

梦想与她 提交于 2019-11-30 08:45:13
问题 How to implement RecyclerView onItemClick listener as we do with ListView, this is my old Adapter class using ListView : public class GenreAdapter extends BaseAdapter { .... @Override public View getView(final int position, View convertView, ViewGroup parent) { // convert view = design View v = convertView; if (v == null) { holder = new ViewHolder(); v = vi.inflate(Resource, null); holder.textTitle = (TextView) v.findViewById(R.id.textTitle); v.setTag(holder); } else { holder = (ViewHolder) v

How to get the position of cardView item in recyclerView?

无人久伴 提交于 2019-11-30 05:28:28
I created one adapter class for recycler for populating cardview layout in recyclerview. It is working fine, but when i click cardView item in recyclerview i need to get position of that cardview item , based on that i need to write a Intent activity. Along with how to delete that cardview item when i swipe left to right. MyAdapter class. public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private NavigationItem[] navigationItem; private Context mContext; public MyAdapter(NavigationItem[] navigationItem) { this.navigationItem = navigationItem; } @Override public

NullPointerException in dissapearence animation of RecyclerView from support v.23.2.0

狂风中的少年 提交于 2019-11-30 05:07:35
问题 In new RecyclerView we can use wrap_content for height (or for width). So Google fixed bug - https://code.google.com/p/android/issues/detail?id=74772 But not all is well in the end. I try to use animation of dissapearence when remove item from RecyclerView. So i use method of Adapter - notifyItemRemoved(int) with any argument and RecyclerView cause NullPointerException. Xml code: ... <RecyclerView android:id="@+id/RecyclerView" android:layout_width="match_parent" android:layout_height="wrap

Android: how can I insert a RecyclerView inside CardView?

坚强是说给别人听的谎言 提交于 2019-11-30 02:01:08
The activity I am talking about must show a RecyclerView populated by CardViews as items. My goal is to show in every CardView a RecyclerView in its turn. Here my Activity's basic xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ConjActivity" > <android.support.v7.widget.RecyclerView android:id="@+id/conjCardList" android:layout_width="match_parent" android:layout_height="match_parent" android

Saving checkbox state from Recyclerview

百般思念 提交于 2019-11-29 23:56:51
问题 I have checkbox in my Recyclerview , now i am able to click it and show a snackbar. But can anyone help me to save the state of the checkbox from the recyclerview. I had created an onclicklistener in onBindViewHolder of the recyclerview adapter. private SparseBooleanArray mCheckedItems = new SparseBooleanArray(); @Override public void onBindViewHolder(final RecyclerViewHolder viewHolder, int i) { // get the single element from the main array DisplayImageOptions options = new

How to pass values from RecycleAdapter to MainActivity or Other Activities

不想你离开。 提交于 2019-11-29 20:30:17
I am working on a shopping cart app,Items are displayed as below.There is a plus, minus (+/-) buttons to choose the number of quantity. If product quantity is changed, I need to pass "productname" and "quantity" to the main activity so that I could use them to prepare final cart. I got some suggestions to use database or some content providers, I am not sure how to do it.., please help MainActivity.java import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager;