Example usage for android.widget RelativeLayout ALIGN_PARENT_LEFT

List of usage examples for android.widget RelativeLayout ALIGN_PARENT_LEFT

Introduction

In this page you can find the example usage for android.widget RelativeLayout ALIGN_PARENT_LEFT.

Prototype

int ALIGN_PARENT_LEFT

To view the source code for android.widget RelativeLayout ALIGN_PARENT_LEFT.

Click Source Link

Document

Rule that aligns the child's left edge with its RelativeLayout parent's left edge.

Usage

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

private RelativeLayout createParticipantView(MemberStatusTO ms) {
    RelativeLayout rl = new RelativeLayout(this);
    int rlW = UIUtils.convertDipToPixels(this, 55);
    rl.setLayoutParams(new RelativeLayout.LayoutParams(rlW, rlW));

    getLayoutInflater().inflate(R.layout.avatar, rl);
    ImageView avatar = (ImageView) rl.getChildAt(rl.getChildCount() - 1);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(avatar.getLayoutParams());
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    avatar.setLayoutParams(params);/*from  w ww  .j a v a  2  s . co  m*/
    setAvatar(avatar, ms.member);

    ImageView statusView = new ImageView(this);
    int w = UIUtils.convertDipToPixels(this, 12);
    RelativeLayout.LayoutParams iconParams = new RelativeLayout.LayoutParams(w, w);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    statusView.setLayoutParams(iconParams);
    statusView.setAdjustViewBounds(true);
    statusView.setScaleType(ScaleType.CENTER_CROP);
    setStatusIcon(statusView, ms);
    rl.addView(statusView);
    return rl;
}

From source file:com.skytree.epubtest.BookViewActivity.java

public void makeNoteBox() {
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height
    noteBox = new SkyBox(this);
    noteBox.setBoxColor(currentColor);/*from   ww  w  . ja va  2 s .co m*/
    noteBox.setArrowHeight(ps(25));
    noteBox.setArrowDirection(false);
    param.leftMargin = ps(50);
    param.topMargin = ps(400);
    int minWidth = Math.min(this.getWidth(), this.getHeight());
    noteBoxWidth = (int) (minWidth * 0.8);
    param.width = noteBoxWidth;
    param.height = ps(300);
    noteBox.setLayoutParams(param);
    noteBox.setArrowDirection(false);

    noteEditor = new EditText(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height
    params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    params.width = LayoutParams.FILL_PARENT;
    params.height = LayoutParams.FILL_PARENT;
    noteEditor.setLayoutParams(params);
    noteEditor.setBackgroundColor(Color.TRANSPARENT);
    noteEditor.setMaxLines(1000);
    noteEditor.setGravity(Gravity.TOP | Gravity.LEFT);
    noteEditor.setOnFocusChangeListener(focusListener);
    noteBox.contentView.addView(noteEditor);

    ePubView.addView(noteBox);
    this.hideNoteBox();
}

From source file:com.aimfire.demo.CamcorderActivity.java

private void adjustUIControls(int rotation) {
    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mShutterLayout.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    mShutterLayout.setLayoutParams(layoutParams);
    mShutterLayout.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mPvButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.ABOVE, 0);
    layoutParams.addRule(RelativeLayout.BELOW, R.id.shutter_layout);
    mPvButton.setLayoutParams(layoutParams);
    mPvButton.setRotation(rotation);//from   w w  w.  ja va2 s . c  o m

    /*
    layoutParams = (RelativeLayout.LayoutParams)mFbButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.ABOVE, R.id.shutter_layout);
    layoutParams.addRule(RelativeLayout.BELOW, 0);
    mFbButton.setLayoutParams(layoutParams);
    mFbButton.setRotation(rotation);
    */

    layoutParams = (RelativeLayout.LayoutParams) mExitButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    mExitButton.setLayoutParams(layoutParams);
    mExitButton.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mView3DButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    mView3DButton.setLayoutParams(layoutParams);
    mView3DButton.setRotation(rotation);

    View view3DPb = findViewById(R.id.view3D_progress_bar);
    layoutParams = (RelativeLayout.LayoutParams) view3DPb.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    view3DPb.setLayoutParams(layoutParams);
    view3DPb.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mScanProgView.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.LEFT_OF, 0);
    layoutParams.addRule(RelativeLayout.RIGHT_OF, 0);
    mScanProgView.setLayoutParams(layoutParams);
    mScanProgView.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mScanModeButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.LEFT_OF, 0);
    layoutParams.addRule(RelativeLayout.RIGHT_OF, 0);
    mScanModeButton.setLayoutParams(layoutParams);
    mScanModeButton.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mLevelButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    mLevelButton.setLayoutParams(layoutParams);
    mLevelButton.setRotation(rotation);

    layoutParams = (RelativeLayout.LayoutParams) mTimeCounter.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.LEFT_OF, R.id.mode_button);
    layoutParams.addRule(RelativeLayout.RIGHT_OF, 0);
    layoutParams.addRule(RelativeLayout.ABOVE, 0);
    layoutParams.addRule(RelativeLayout.BELOW, 0);
    mTimeCounter.setLayoutParams(layoutParams);

    if ((rotation == 0) || (rotation == 180)) {
        mTimeCounter.setTranslationY(0);
    } else {
        mTimeCounter.setTranslationY(mTimeCounter.getWidth() / 2);
    }
    mTimeCounter.setRotation(rotation);

    CustomToast.setRotation(rotation);
}