Example usage for android.widget RelativeLayout ABOVE

List of usage examples for android.widget RelativeLayout ABOVE

Introduction

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

Prototype

int ABOVE

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

Click Source Link

Document

Rule that aligns a child's bottom edge with another child's top edge.

Usage

From source file:de.sourcestream.movieDB.controller.MovieDetails.java

/**
 * Updates the icons position in the movie info tap when called.
 */// w  ww.j a  v a2  s  . c  o  m
public void updateIconUpPosInInfoTab() {
    RelativeLayout.LayoutParams p3 = new RelativeLayout.LayoutParams(homeIcon.getWidth(), homeIcon.getHeight());
    RelativeLayout.LayoutParams p2 = new RelativeLayout.LayoutParams(trailerIcon.getWidth(),
            trailerIcon.getHeight());
    RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(galleryIcon.getWidth(),
            galleryIcon.getHeight());
    p3.addRule(RelativeLayout.ALIGN_PARENT_END);
    p2.addRule(RelativeLayout.ALIGN_PARENT_END);
    p.addRule(RelativeLayout.ALIGN_PARENT_END);
    if (iconDirection == 1) {
        p3.addRule(RelativeLayout.ABOVE, R.id.moreIcon);
        p3.setMargins(0, 0, (int) (23 * scale), (int) (44 * scale));
        p2.addRule(RelativeLayout.ABOVE, R.id.homeIcon);
        p2.setMargins(0, 0, (int) (23 * scale), (int) (15.5f * scale));
        p.addRule(RelativeLayout.ABOVE, R.id.trailerIcon);
        p.setMargins(0, 0, (int) (23 * scale), (int) (15 * scale));
    } else {
        p3.addRule(RelativeLayout.BELOW, R.id.moreIcon);
        p3.setMargins(0, (int) (16 * scale), (int) (23 * scale), 0);
        p2.addRule(RelativeLayout.BELOW, R.id.homeIcon);
        p2.setMargins(0, (int) (15.5f * scale), (int) (23 * scale), 0);
        p.addRule(RelativeLayout.BELOW, R.id.trailerIcon);
        p.setMargins(0, (int) (15 * scale), (int) (23 * scale), 0);
    }

    movieDetailsInfo.getHomeIcon().setLayoutParams(p3);
    movieDetailsInfo.getTrailerIcon().setLayoutParams(p2);
    movieDetailsInfo.getGalleryIcon().setLayoutParams(p);

}

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);/*w ww  . j  a  v  a2  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);
}