I have a cell in a ListView that has a bunch of text in it. I show the first two rows of text and then end it with a \"...\" if it goes beyond. I want a user to be able to t
What you want to do is have a flag that knows if the row is expanded or not. If it is, then run an animation that shrinks it, and vice versa.
public void onListItemClicked(int position)
{
View v = listView.getView(position);
if(expanded[position])
v.startAnimation(shrinkAnimation);
else
v.startAnimation(growAnimation);
expanded[position] = !expanded[position];
}
Simple.
However if what you are doing is something similar to the screen shot you implemented, I would advise against doing this with a ListView. The views are each different enough to warrant just doing this manually with LinearLayouts
. Only use the ListView if the number of rows is unknown or very large.