开发者

Is it possible to change size of the item in ListView?

I have a ListView with few items. Is it possible to change size of the selected item in the ListView. For examp开发者_JAVA百科le, I want to expand selected item to show some buttons.

I appreciate you for help in advance.


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!");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜