Code example for LinearLayout

Methods: addViewsetOrientation

0
    public static class SubGammaActivity extends Activity {
        @Override 
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
 
            final LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(LinearLayout.VERTICAL);
 
            final GammaTextView gamma = new GammaTextView(this);
            final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT
            ); 
            lp.setMargins(0, 74, 0, 0);
            layout.addView(gamma, lp);
 
            setContentView(layout);
        } 
    } 
}