views:

47

answers:

3

I have a ListView with few items. Is it possible to change size of the selected item in the ListView. For example, I want to expand selected item to show some buttons.

I appreciate you for help in advance.

+1  A: 

Set the visibility of these buttons as View.GONE in the items that you don't want it. Whenever you need them set them as View.VISIBLE. By setting them as View.GONE android doesn't include them in any kind of measurement (width or height) and it looks like nothing was supposed to be there.

  btn = (Button) findViewById(R.id.btn);

if(condition){
  btn.setVisibility(View.VISIBLE);
  btn.setText("You can see me!");
} else {
  btn.setVisibility(View.GONE);
 // btn.setText("Now you can't!");
}
Sameer Segal
Thanks, I thought about this, but I want to have full control of the size, because later I am going to make it animated.
barmaleikin
You can use dips to specify minHeights/maxHeights - think about using ViewStubs too.
Sameer Segal
+1  A: 

Use a ViewStub for that kind of behaviour.

Check this tutorial.

Macarse
A: 

Thanks you all.

barmaleikin