Example usage for android.widget RelativeLayout ALIGN_PARENT_BOTTOM

List of usage examples for android.widget RelativeLayout ALIGN_PARENT_BOTTOM

Introduction

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

Prototype

int ALIGN_PARENT_BOTTOM

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

Click Source Link

Document

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

Usage

From source file:org.zywx.wbpalmstar.engine.universalex.EUExBase.java

protected final void adptLayoutParams(RelativeLayout.LayoutParams rParms, FrameLayout.LayoutParams outParm) {
    if (null == rParms) {
        return;// w w  w .  java 2 s  . c o  m
    }
    int TRUE = RelativeLayout.TRUE;
    int ALIGN_PARENT_LEFT = RelativeLayout.ALIGN_PARENT_LEFT;
    int ALIGN_PARENT_TOP = RelativeLayout.ALIGN_PARENT_TOP;
    int ALIGN_PARENT_RIGHT = RelativeLayout.ALIGN_PARENT_RIGHT;
    int ALIGN_PARENT_BOTTOM = RelativeLayout.ALIGN_PARENT_BOTTOM;
    int CENTER_IN_PARENT = RelativeLayout.CENTER_IN_PARENT;
    int CENTER_HORIZONTAL = RelativeLayout.CENTER_HORIZONTAL;
    int CENTER_VERTICAL = RelativeLayout.CENTER_VERTICAL;
    try {
        int[] rules = rParms.getRules();
        if (rules[ALIGN_PARENT_LEFT] == TRUE) {
            outParm.gravity |= Gravity.LEFT;
        }
        if (rules[ALIGN_PARENT_TOP] == TRUE) {
            outParm.gravity |= Gravity.TOP;
        }
        if (rules[ALIGN_PARENT_RIGHT] == TRUE) {
            outParm.gravity |= Gravity.RIGHT;
        }
        if (rules[ALIGN_PARENT_BOTTOM] == TRUE) {
            outParm.gravity |= Gravity.BOTTOM;
        }
        if (rules[CENTER_IN_PARENT] == TRUE) {
            outParm.gravity |= Gravity.CENTER;
        }
        if (rules[CENTER_HORIZONTAL] == TRUE) {
            outParm.gravity |= Gravity.CENTER_HORIZONTAL;
        }
        if (rules[CENTER_VERTICAL] == TRUE) {
            outParm.gravity |= Gravity.CENTER_VERTICAL;
        }
    } catch (Exception e) {
        ;
    }
}

From source file:group.pals.android.lib.ui.filechooser.FragmentFiles.java

/**
 * Shows footer view./*  w w w . jav  a  2s. c  om*/
 * 
 * @param show
 *            {@code true} or {@code false}.
 * @param text
 *            the message you want to set.
 * @param center
 *            {@code true} or {@code false}.
 */
@SuppressLint("InlinedApi")
private void showFooterView(boolean show, String text, boolean center) {
    if (show) {
        mFooterView.setText(text);

        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        if (!center)
            lp.addRule(RelativeLayout.ABOVE, R.id.afc_view_files_footer_view);
        mViewFilesContainer.setLayoutParams(lp);

        lp = (RelativeLayout.LayoutParams) mFooterView.getLayoutParams();
        lp.addRule(RelativeLayout.CENTER_IN_PARENT, center ? 1 : 0);
        lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, center ? 0 : 1);
        mFooterView.setLayoutParams(lp);

        mFooterView.setVisibility(View.VISIBLE);
    } else
        mFooterView.setVisibility(View.GONE);
}

From source file:com.stikyhive.stikyhive.ChattingActivity.java

public void clickFileTransfer(View v) {
    flagMakeOffer = true;//from  w  w  w. j  a  v  a 2s.  com
    showFileChooser();
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            0);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    layoutTalk.setLayoutParams(params);
    layoutTalk.setGravity(Gravity.CENTER);
    flagRecord = false;
    //loadFileList();
    // onCreateDialog(DIALOG_LOAD_FILE);
}

From source file:com.stikyhive.stikyhive.ChattingActivity.java

public void clickImageTransfer(View v) {
    flagMakeOffer = true;/*from  www  . ja  va  2s. co  m*/
    showPhoto();
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            0);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    layoutTalk.setLayoutParams(params);
    layoutTalk.setGravity(Gravity.CENTER);
    flagRecord = false;
}

From source file:com.haibison.android.anhuu.FragmentFiles.java

/**
 * Shows footer view./*from   w  w  w  .j  av  a  2  s. c o m*/
 * 
 * @param show
 *            {@code true} or {@code false}.
 * @param text
 *            the message you want to set.
 * @param center
 *            {@code true} or {@code false}.
 */
@SuppressLint("InlinedApi")
private void showFooterView(boolean show, String text, boolean center) {
    if (show) {
        mFooterView.setText(text);

        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        if (!center)
            lp.addRule(RelativeLayout.ABOVE, R.id.anhuu_f5be488d_view_files_footer_view);
        mViewFilesContainer.setLayoutParams(lp);

        lp = (RelativeLayout.LayoutParams) mFooterView.getLayoutParams();
        lp.addRule(RelativeLayout.CENTER_IN_PARENT, center ? 1 : 0);
        lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, center ? 0 : 1);
        mFooterView.setLayoutParams(lp);

        mFooterView.setVisibility(View.VISIBLE);
    } else
        mFooterView.setVisibility(View.GONE);
}

From source file:com.spoiledmilk.ibikecph.navigation.SMRouteNavigationActivity.java

public void setInstructionViewState(InstrcutionViewState newState) {

    // if (mapFragment != null && !mapFragment.currentlyRouting
    // && instructionsViewState ==
    // SMRouteNavigationActivity.InstrcutionViewState.Invisible
    // && newState == SMRouteNavigationActivity.InstrcutionViewState.Normal)
    // return;//from   w  w  w . j  av a2  s . co m

    // if (instructionsViewState == newState) {
    // return;
    // }

    instructionList.smoothScrollToPosition(0);

    if (newState == InstrcutionViewState.Maximized) {
        pullTouchMax.setVisibility(View.VISIBLE);
        pullTouchNormal.setVisibility(View.GONE);
        mapTopDisabledView.setVisibility(View.VISIBLE);
        instructionsViewMax.setLayoutParams(paramsInstructionsMaxMaximized);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsViewMax.setVisibility(View.VISIBLE);
        if (hasDarkImage()) {
            btnClose.setImageResource(R.drawable.btn_close_dark_selector);
            viewDistance.setBackgroundResource(R.drawable.distance_black);
            textTime.setTextColor(Color.WHITE);
        }
        darkenedView.getBackground().setAlpha(200);
    } else if (newState == InstrcutionViewState.Normal) {
        pullTouchMax.setVisibility(View.GONE);
        pullTouchNormal.setVisibility(View.VISIBLE);
        mapTopDisabledView.setVisibility(View.GONE);
        instructionsViewMax.setLayoutParams(paramsInstructionsMaxNormal);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsViewMax.setVisibility(View.GONE);
        darkenedView.setVisibility(View.GONE);
        if (hasDarkImage()) {
            btnClose.setImageResource(R.drawable.btn_close_selector);
            viewDistance.setBackgroundResource(R.drawable.distance_white);
            textTime.setTextColor(Color.BLACK);
        }
        RelativeLayout.LayoutParams paramsBtnTrack = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        paramsBtnTrack.setMargins(Util.dp2px(10), Util.dp2px(10), Util.dp2px(10), Util.dp2px(10));
        paramsBtnTrack.alignWithParent = true;
        paramsBtnTrack.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        paramsBtnTrack.addRule(RelativeLayout.ABOVE, instructionsView.getId());
        btnTrack.setLayoutParams(paramsBtnTrack);
    } else if (newState == InstrcutionViewState.Minimized) {
        pullTouchMax.setVisibility(View.GONE);
        pullTouchNormal.setVisibility(View.GONE);
        mapTopDisabledView.setVisibility(View.GONE);
        instructionsViewMax.setLayoutParams(paramsInstructionsMaxMinimized);
        darkenedView.setVisibility(View.GONE);
        if (hasDarkImage()) {
            btnClose.setImageResource(R.drawable.btn_close_selector);
            viewDistance.setBackgroundResource(R.drawable.distance_white);
            textTime.setTextColor(Color.BLACK);
        }
        instructionsView.setVisibility(View.GONE);
        instructionsViewMax.setVisibility(View.GONE);
        instructionsViewMin.setVisibility(View.VISIBLE);
        RelativeLayout.LayoutParams paramsBtnTrack = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        paramsBtnTrack.setMargins(Util.dp2px(10), Util.dp2px(10), Util.dp2px(10), Util.dp2px(10));
        paramsBtnTrack.alignWithParent = true;
        paramsBtnTrack.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        paramsBtnTrack.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        btnTrack.setLayoutParams(paramsBtnTrack);
    } else if (newState == InstrcutionViewState.Invisible) {
        pullTouchMax.setVisibility(View.GONE);
        pullTouchNormal.setVisibility(View.GONE);
        mapTopDisabledView.setVisibility(View.GONE);
        instructionsViewMax.setLayoutParams(paramsInstructionsMaxNormal);
        darkenedView.setVisibility(View.GONE);
        if (hasDarkImage()) {
            btnClose.setImageResource(R.drawable.btn_close_selector);
            viewDistance.setBackgroundResource(R.drawable.distance_white);
            textTime.setTextColor(Color.BLACK);
        }
        instructionsView.setVisibility(View.GONE);
        instructionsViewMax.setVisibility(View.GONE);
        instructionsViewMin.setVisibility(View.GONE);
    }

    if (newState != InstrcutionViewState.Maximized && mapFragment != null
            && mapFragment.locationOverlay != null) {
        mapFragment.locationOverlay.enableMyLocation(mapFragment.locationProvider == null
                ? mapFragment.locationProvider = new GpsMyLocationProvider(this)
                : mapFragment.locationProvider);
    }

    // enter state actions
    // switch (newState) {
    // case Invisible:
    // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE);
    // break;
    // case Normal:
    // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE);
    // findViewById(R.id.pullTouchNormal).setVisibility(View.VISIBLE);
    // findViewById(R.id.pullTouchMax).setVisibility(View.GONE);
    // instructionsView.setVisibility(View.VISIBLE);
    // View mapContainer = findViewById(R.id.map_container);
    // RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams)
    // mapContainer.getLayoutParams();
    // lParams.addRule(RelativeLayout.ABOVE, R.id.instructionsView);
    // lParams.alignWithParent = true;
    // mapContainer.setLayoutParams(lParams);
    // isMaximized = false;
    // break;
    // case Maximized:
    // findViewById(R.id.mapTopDisabledView).setVisibility(View.VISIBLE);
    // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE);
    // findViewById(R.id.pullTouchMax).setVisibility(View.VISIBLE);
    // isMaximized = false;
    // instructionsViewMax.setClickable(true);
    // instructionsViewMax.setVisibility(View.VISIBLE);
    // break;
    // case Minimized:
    // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE);
    // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE);
    // findViewById(R.id.pullTouchMax).setVisibility(View.GONE);
    // isMaximized = false;
    // instructionsViewMin.setVisibility(View.VISIBLE);
    // break;
    // }
    //
    // if (newState != InstrcutionViewState.Maximized) {
    // if (hasDarkImage()) {
    // btnClose.setImageResource(R.drawable.btn_close);
    // viewDistance.setBackgroundResource(R.drawable.distance_white);
    // textTime.setTextColor(Color.BLACK);
    // }
    // darkenedView.setVisibility(View.GONE);
    // instructionsViewMax.clearAnimation();
    //
    // // paramsInstructionsMax.bottomMargin = -(int)
    // (Util.getScreenHeight());
    // // paramsInstructionsMax.topMargin = (int) (Util.getScreenHeight() -
    // instructionsView.getHeight() -
    // // Util.dp2px(10));
    // // instructionsViewMax.setLayoutParams(paramsInstructionsMax);
    // mapFragment.locationOverlay.enableMyLocation(new
    // GpsMyLocationProvider(this));
    // }
    // if (newState == InstrcutionViewState.Normal) {
    // findViewById(R.id.pullTouchNormal).setVisibility(View.VISIBLE);
    // } else {
    // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE);
    // }

    instructionsViewState = newState;
}

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

private void adjustUIControls(int rotation) {
    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mCaptureButton.getLayoutParams();
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
    layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    mCaptureButton.setLayoutParams(layoutParams);
    mCaptureButton.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.capture_button);
    mPvButton.setLayoutParams(layoutParams);
    mPvButton.setRotation(rotation);/*from  www.j  av  a2s . c  om*/

    /*
    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.capture_button);
    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);

    layoutParams = (RelativeLayout.LayoutParams) mModeButton.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);
    mModeButton.setLayoutParams(layoutParams);
    mModeButton.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);

    CustomToast.setRotation(rotation);
}

From source file:com.hb.hkm.slidinglayer.SlidLayer.java

private void adjustLayoutParams() {

    ViewGroup.LayoutParams baseParams = getLayoutParams();

    if (baseParams instanceof LayoutParams) {

        LayoutParams layoutParams = (LayoutParams) baseParams;

        switch (mScreenSide) {
        case STICK_TO_BOTTOM:
            layoutParams.gravity = Gravity.BOTTOM;
            break;
        case STICK_TO_LEFT:
            layoutParams.gravity = Gravity.LEFT;
            break;
        case STICK_TO_RIGHT:
            layoutParams.gravity = Gravity.RIGHT;
            break;
        case STICK_TO_TOP:
            layoutParams.gravity = Gravity.TOP;
            break;
        }//from   ww  w . j  ava2s. co m
        setLayoutParams(baseParams);

    } else if (baseParams instanceof RelativeLayout.LayoutParams) {

        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) baseParams;

        switch (mScreenSide) {
        case STICK_TO_BOTTOM:
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            break;
        case STICK_TO_LEFT:
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
            break;
        case STICK_TO_RIGHT:
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            break;
        case STICK_TO_TOP:
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
            break;
        }
    }

}

From source file:com.stikyhive.stikyhive.ChattingActivity.java

public void clickSend(View v) {
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            0);//from w w  w.j  av a 2 s . c  om
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    layoutTalk.setLayoutParams(params);
    layoutTalk.setGravity(Gravity.CENTER);
    flagRecord = false;
    /*txtEditorWatcher = new TextWatcher() {
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
            
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        //This sets a textview to the current length
        Log.i("Text ", " is changed" + s + "**");
        if (s.toString().substring(0, s.length()).equalsIgnoreCase(" ")) {
            Log.i("Can't ", " space");
        }
        // txtTitleCha.setText(String.valueOf(50 - s.length()) + " characters left");
    }
            
    public void afterTextChanged(Editable s) {
    }
    };*/

    messageServer = edTxtMsg.getText().toString();
    lv.smoothScrollToPosition(adapter.getCount() - 1);
    if (messageServer.equals("")) {
        setShakeAnimation(edTxtMsg);
        Toast.makeText(getApplicationContext(), "Enter your message", Toast.LENGTH_SHORT).show();
    } else {
        // edTxtMsg.addTextChangedListener(txtEditorWatcher);
        calcualteTodayDate();
        Log.i("Time Server ", " * " + timeSendServer);
        flagChatting = true;
        msg = edTxtMsg.getText().toString();
        new regTask().execute("Send message to ");
        adapter.add(new StikyChat("", edTxtMsg.getText().toString(), false, timeSend, "", 0, 0, "", "", "",
                null, ""));
        lv.smoothScrollToPosition(adapter.getCount() - 1);
        edTxtMsg.setText("");
    }

}

From source file:com.stikyhive.stikyhive.ChattingActivity.java

public void clickPay(View v) {
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            0);/*www  . j  av a  2  s  .c om*/
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    layoutTalk.setLayoutParams(params);
    layoutTalk.setGravity(Gravity.CENTER);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    flagPay = true;
    //        Intent intent = new Intent("com.arctech.MAKEOFFER");
    //        intent.putExtra("recipientName", chatRecipient);
    //        intent.putExtra("recipientUrl", chatRecipientUrl);
    //        startActivity(intent);
    flagChatting = false;
    new regTask3().execute("Pay");
}