Search in sources :

Example 1 with LayoutParams

use of android.widget.AbsoluteLayout.LayoutParams in project platform_frameworks_base by android.

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)

Example 2 with LayoutParams

use of android.widget.AbsoluteLayout.LayoutParams in project XobotOS by xamarin.

the class WebTextView method setRect.

/**
     * Determine the position and size of WebTextView, and add it to the
     * WebView's view heirarchy.  All parameters are presumed to be in
     * view coordinates.  Also requests Focus and sets the cursor to not
     * request to be in view.
     * @param x         x-position of the textfield.
     * @param y         y-position of the textfield.
     * @param width     width of the textfield.
     * @param height    height of the textfield.
     */
/* package */
void setRect(int x, int y, int width, int height) {
    LayoutParams lp = (LayoutParams) getLayoutParams();
    if (null == lp) {
        lp = new LayoutParams(width, height, x, y);
    } else {
        lp.x = x;
        lp.y = y;
        lp.width = width;
        lp.height = height;
    }
    if (getParent() == null) {
        // Insert the view so that it's drawn first (at index 0)
        mWebView.addView(this, 0, lp);
    } else {
        setLayoutParams(lp);
    }
    // Set up a measure spec so a layout can always be recreated.
    mWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
    mHeightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
}
Also used : LayoutParams(android.widget.AbsoluteLayout.LayoutParams)

Example 3 with LayoutParams

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

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)

Example 4 with LayoutParams

use of android.widget.AbsoluteLayout.LayoutParams in project XobotOS by xamarin.

the class WebTextView method ensureLayout.

void ensureLayout() {
    if (getLayout() == null) {
        // Ensure we have a Layout
        measure(mWidthSpec, mHeightSpec);
        LayoutParams params = (LayoutParams) getLayoutParams();
        if (params != null) {
            layout(params.x, params.y, params.x + params.width, params.y + params.height);
        }
    }
}
Also used : LayoutParams(android.widget.AbsoluteLayout.LayoutParams)

Example 5 with LayoutParams

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

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