http://www.learn-android.com/category/beginner/
Create HardCode Layout
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT));
layout.setOrientation(LinearLayout.HORIZONTAL);

Layout Margin
MarginLayoutParams margin = new ViewGroup.MarginLayoutParams(layout[i].getLayoutParams());
margin.setMargins(LAYOUT_MARGIN, LAYOUT_MARGIN, LAYOUT_MARGIN, 0);