Code example for FrameLayout

Methods: addView

0
public class BitmapsAlphaActivity extends Activity {
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final BitmapsView view = new BitmapsView(this);
        final FrameLayout layout = new FrameLayout(this);
        layout.addView(view, new FrameLayout.LayoutParams(480, 800, Gravity.CENTER));
        setContentView(layout);
    } 
 
    static class BitmapsView extends View {
        private Paint mBitmapPaint;
        private final Bitmap mBitmap1;
        private final Bitmap mBitmap2;
        private Bitmap mBitmap3;
 
        BitmapsView(Context c) {
            super(c);
 
            Log.d("OpenGLRenderer", "Loading sunset1, default options");
            mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);