[英]How to show recycler view when i click an item in another recyclerview
I have used two Recyclerview
inside a Recyclerview
item. 我在
Recyclerview
项目中使用了两个Recyclerview
。 My problem is I want to hide the recyclerview(kitchen grocery)
of 1st item(fruits and vegetable) when the user clicks 2nd item (fruits and vegetable)
and have to show that particular items recycled view. 我的问题是,当用户单击第二项目
(fruits and vegetable)
时,我想隐藏第一项目(水果和蔬菜)的recyclerview(kitchen grocery)
,并且必须显示特定项目的回收视图。 Herewith I have attached the images of my requirement for your understanding.Please tell me a solution .when I click the second item the first items recyclerview should hide.How to achieve this. 随函附上我需要理解的图像。请告诉我一个解决方案。当我单击第二个项目时,recyclerview应隐藏的第一个项目。如何实现此目的。
Thanks in Advance.
提前致谢。
yes...Using Expandablelistview has solved my problem.here is the link for expandablelistview https://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ 是的...使用Expandablelistview解决了我的问题。这是expandablelistview的链接https://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
This tutorial will show expand of all item.So replace this code in main activity to expand one item. 本教程将显示所有项目的展开。因此,请在主活动中替换此代码以展开一个项目。
expListView.setOnGroupExpandListener(new OnGroupExpandListener() {
// TODO Colapse Here Using this... in android
int previousGroup = -1;
boolean flag = false;
@Override
public void onGroupExpand(int groupPosition) {
// Log.e("keshav", "onGroupClick is -> " + groupPosition);
Toast.makeText(getApplicationContext(),
listDataHeader.get(groupPosition) + " Expanded",
Toast.LENGTH_SHORT).show();
if (groupPosition != previousGroup && flag) {
expListView.collapseGroup(previousGroup);
}
previousGroup = groupPosition;
flag = true;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.