I tried to use LayoutParams like set layout margins dynamically, but AbsListView.LayoutParams does not have a setMargins() function. I need to do this dynamically in the java, not using xml. Thanks
Asked
Active
Viewed 52 times
1 Answers
1
AbsListView.LayoutParams
applies to the items in the list. You can cast to MarginLayout.LayoutParams
for the list view itself, (depending on the ViewGroup it is in).

Greg Ennis
- 14,917
- 2
- 69
- 74
-
MarginLayout.LayoutParams does not have setMargins either – MarcusH Jan 13 '15 at 04:43
-
Correct, you just change the margin public fields like marginLeft and then call setLayoutParams – Greg Ennis Jan 13 '15 at 04:47