简体   繁体   English

当我单击另一个recyclerview中的项目时如何显示回收者视图

[英]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应隐藏的第一个项目。如何实现此目的。 当我单击第二个项目时,第一个项目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.

相关问题 在项目上单击RecyclerView的监听器 - 如何在回收站视图中使用项目的位置来平滑滚动到另一个列表视图? - On Item Click Listener for RecyclerView - How can I use the position of an item in a recycler view to smoothscroll to another listview? 从回收者视图中删除项目时,回收者视图未刷新吗? - Recycler view is not refreshed when i delete an item from recycler view? 使用导航组件单击 RecyclerView 项目时如何从 RecyclerView OnClick 侦听器更改片段 - How to change fragment from the Recycler View OnClick Listener when RecyclerView item is clicked using Navigation Components 如果我在回收器视图中有数千个项目,那么如何在每个项目上设置项目点击侦听器 - If I Have thousands of items inside the recycler view then How can I set the item click listener on each item 当我从图库中选择图像以在 recyclerview android 中显示时,我的回收站视图中没有任何内容 - I didn't get anything in my recycler view when i select image from gallery to show in recyclerview android 单击相应项目时如何在recyclerview项目顶部显示弹出窗口 - How to show popup on top of recyclerview item when we click on respective item 如何在android中的recycler视图中显示第一项的选择? - how to show selection of the lst item in recycler view in android? 如何在 Android 中单击 Recycler View 并获取另一个 dataActivity 像 playstore? - How to click on Recycler View in Android and get Another dataActivity like playstore? 在回收站视图项目中单击增量按钮时,如何停止在回收站视图中自动向上滚动? - How to stop automatic scroll up in recycler view when increment button is clicked in recycler view item? 回收站视图不显示任何项目 - Recycler View doesn't show any item
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM