简体   繁体   English

RecyclerView onClick 导致相同的活动?

[英]RecyclerView onClick result in Same activity?

I want the feature in the image.我想要图像中的功能。 Please check the image.请检查图像。 here这里

When I click the recycle view item, I want to show the item details below the item.当我单击回收视图项目时,我想在项目下方显示项目详细信息。 Please check the image and help me..Thank you请检查图像并帮助我..谢谢

in your adapter class:在您的适配器类中:

@Override
public View getView(int position, View convertView, ViewGroup parent) {
View listItemView = convertView;
listItemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //put your code here
            }
        });
}

The recyclerList view should contain the following : recyclerList 视图应包含以下内容:

  1. View having details of the list Item in collapsed state (Example Name)查看具有折叠状态的列表项的详细信息(示例名称)
  2. View having the expanded details of the list item (Example - description) - this view will set to visibility - gone by default.查看具有列表项的展开详细信息(示例 - 描述) - 此视图将设置为可见性 - 默认情况下消失。

In RecyclerViewAdapter - onBindViewHolder在 RecyclerViewAdapter - onBindViewHolder

holder.firstview.setOnClickListener - set the visibility of the secondview to visible holder.firstview.setOnClickListener - 将第二个holder.firstview.setOnClickListener的可见性设置为可见

Example :例子 :

holder.firstView.setOnClickListener(new View.OnClickListener()
      {
          @Override
          public void onClick(View view)
          {
            holder.secondView.setVisibility(View.VISIBLE);
          }
      });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM