Listview Inside RecyclerView Dont Scroll
i have a list view inside a recyclerview like this: and scrolling of listview doesnt work on this implementation. my goal is when clicking on button the listview toggle to show an
Solution 1:
You should not use a ListView
inside another scrollable view.
In this case you are using a ListView inside a RecyclerView.
Use a LinearLayout instead of the ListView. Something like:
public class MyListLayout extends LinearLayout implements
View.OnClickListener {
private Adapter list;
private View.OnClickListener mListener;
public MyListLayout(Context context) {
super(context);
}
public MyListLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyListLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onClick(View v) {
if (mListener!=null)
mListener.onClick(v);
}
public void setList(Adapter list) {
this.list = list;
//Popolute list
if (this.list!=null){
for (int i=0;i<this.list.getCount();i++){
View item= list.getView(i, null,null);
this.addView(item);
}
}
}
public void setmListener(View.OnClickListener mListener) {
this.mListener = mListener;
}
}
Post a Comment for "Listview Inside RecyclerView Dont Scroll"