Home » Android » android – How to Change list view's height progmmatically..?

android – How to Change list view's height progmmatically..?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want to know how to change height of the list view programmatically.

Is it possible to change the child items height for individual list item…?

How to&Answers:

Noby if you want to change the hight of Child items you add new item_row layouts for each child and change it height as you want and inflate it using View getView method ………..

If youi want to change height of listview….

list.setLayoutParams(new RelativeLayout.LayoutParams(155, 115));

LayoutParams.fill_parent and LayoutParams.wrap_content

enter your listview width and height in paranthases.,,,, and in your xml file only listiew in relative layout………..

Answer:

    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height = whatYouWant;
    listView.setLayoutParams(params);
    listView.requestLayout();