Java tutorial
//package com.java2s; /** * (c) Winterwell Associates Ltd, used under MIT License. This file is background IP. */ import android.view.View; import android.widget.LinearLayout; public class Main { public static final boolean DEBUG = false; public static View addSpacer(LinearLayout row) { View spacer = new View(row.getContext()); // if (DEBUG) spacer.setBackgroundColor(Color.GREEN); android.widget.LinearLayout.LayoutParams params = new android.widget.LinearLayout.LayoutParams( DEBUG ? 1 : 0, DEBUG ? 1 : 0, 1); row.addView(spacer, params); return spacer; } }