Code example for LinearLayout

Methods: addViewsetOrientation, post

0
public class TextGammaActivity 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);
        layout.addView(gamma, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT
        )); 
 
        setContentView(layout);
 
        layout.post(new Runnable() {
            public void run() { 
                Bitmap b = Bitmap.createBitmap(gamma.getWidth(), gamma.getHeight(),
                        Bitmap.Config.ARGB_8888);
                Canvas c = new Canvas(b);
                c.drawColor(0, PorterDuff.Mode.CLEAR);