UMAR-MOBITSOLUTIONS UMAR-MOBITSOLUTIONS - 3 months ago 16
Android Question

how to set marginBottom in android listview or linearlayout Dynamically?

friends,

i want to set layout_marginBottom using java code or dynamically

in list view or linearlayout

any one guide me how to achieve this?

any help would be appreciated.

Answer
ListView lst=getListView();

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                            LayoutParams.FILL_PARENT,
                            LayoutParams.FILL_PARENT
                        );
params.setMargins(0, 0, 0, 0); //left,top,right,bottom
lst.setLayoutParams(params);
Comments