I am programatically adding custom views to a vertical LinearLayout, and I would like there to be some space between the views. I have tried adding: setPadding(0, 1, 0, 1)
The sample below just does what you need programatically. I have used a fixed size of (140,398).
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(140, 398); layoutParams.setMargins(24, 0, 24, 0); layout.addView(button,layoutParams);