Good day, dear. There is such a task. Display a ListView and in it in each element certain data with an ArrayList. But there is one nuance. By default (standard), each element is shown only half (it consists of 2 layouts for one of which is visibility = gone), and by clicking on this item it should be shown in full (for both layouts, visibility = visible), by clicking back again hide extra part. It is clear that I will create a custom adapter and stick the data into it, but how can I expand and collapse exactly the element to which I tap, and not the last one? Please tell me how to implement it.
Code:
@Override public View getView(int position, View convertView, ViewGroup parent) { // используем созданные, но не используемые view View view = inflater.inflate(R.layout.list_view_item, parent, false); Product p = getProduct(position); text1.setText(p.getName()); text2.setText(p.getLastName()); layoutParent.setOnClicListner(new OnClickListener() { @Override public void onClick(View v) { if(layiutTwo.getVisibiliti() == View.VISIBLE){ layiutTwo.setVisibiliti().View.GONE; } else { layiutTwo.setVisibiliti().View.VISIBLE; } } }); return view; } 
getViewmethod of the adapter, hang click listeners ongetViewand change the visibility of individual elements. But it will have to remove the listeners of clicks hung on the adapter outside. - Yuriy SPb ♦