Search in sources :

Example 6 with LayoutParams

use of android.widget.AbsoluteLayout.LayoutParams in project android_frameworks_base by crdroidandroid.

the class MultiProducerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // To make things simple - we do a quick and dirty absolute layout.
    final AbsoluteLayout layout = new AbsoluteLayout(this);
    // Create the outer frame
    if (USE_FRAME) {
        mFrameTarget = new View(this);
        LayoutParams frameLP = new LayoutParams(WIDTH, HEIGHT, 0, 0);
        layout.addView(mFrameTarget, frameLP);
    }
    // Create the background which fills the gap between content and frame.
    if (USE_BACK) {
        mBackgroundTarget = new View(this);
        LayoutParams backgroundLP = new LayoutParams(WIDTH - 2 * BORDER_WIDTH, HEIGHT - 2 * BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH);
        layout.addView(mBackgroundTarget, backgroundLP);
    }
    // Create the content
    // Note: We reduce the size by CONTENT_GAP pixels on right and bottom, so that they get
    // drawn by the backdrop.
    mContent = new View(this);
    mContent.setBackground(new ColorPulse(0xFFF44336, 0xFF9C27B0, null));
    mContent.setOnClickListener(this);
    LayoutParams contentLP = new LayoutParams(WIDTH - 2 * BORDER_WIDTH - CONTENT_GAP, HEIGHT - 2 * BORDER_WIDTH - CONTENT_GAP, BORDER_WIDTH, BORDER_WIDTH);
    layout.addView(mContent, contentLP);
    setContentView(layout);
}
Also used : LayoutParams(android.widget.AbsoluteLayout.LayoutParams) View(android.view.View) AbsoluteLayout(android.widget.AbsoluteLayout)

Aggregations

LayoutParams (android.widget.AbsoluteLayout.LayoutParams)6 View (android.view.View)4 AbsoluteLayout (android.widget.AbsoluteLayout)4