Example usage for android.view Gravity BOTTOM

List of usage examples for android.view Gravity BOTTOM

Introduction

In this page you can find the example usage for android.view Gravity BOTTOM.

Prototype

int BOTTOM

To view the source code for android.view Gravity BOTTOM.

Click Source Link

Document

Push object to the bottom of its container, not changing its size.

Usage

From source file:com.algo.hha.emojiicon.EmojiconsPopup.java

/**
 * Use this function to show the emoji popup.
 * NOTE: Since, the soft keyboard sizes are variable on different android devices, the 
 * library needs you to open the soft keyboard atleast once before calling this function.
 * If that is not possible see showAtBottomPending() function.
 * //  w w w  .  j av  a 2s . c o  m
 */
public void showAtBottom() {
    showAtLocation(rootView, Gravity.BOTTOM, 0, 0);
}

From source file:android.support.v7ox.widget.ButtonBarLayout.java

private void setStacked(boolean stacked) {
    setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
    setGravity(stacked ? Gravity.RIGHT : Gravity.BOTTOM);
    final View spacer = findViewById(R.id.spacer);
    if (spacer != null) {
        spacer.setVisibility(stacked ? View.GONE : View.INVISIBLE);
    }//www  .ja  v a 2 s  .  com
    // Reverse the child order. This is specific to the Material button
    // bar's layout XML and will probably not generalize.
    final int childCount = getChildCount();
    for (int i = childCount - 2; i >= 0; i--) {
        bringChildToFront(getChildAt(i));
    }
}

From source file:com.lamcreations.scaffold.common.activities.CoordinatorActivity.java

protected int getFabAnchorGravity() {
    return Gravity.BOTTOM | GravityCompat.END;
}

From source file:com.ayoview.sample.textview.badge.ViewsFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.counter: {
        counterBadge.incrementBadgeCount(1);
        break;//from  w  w w  . ja v  a  2s.c om
    }

    case R.id.gravity: {
        gravityBadge.incrementBadgeCount(1);
        Log.d(getClass().getName(), String.valueOf(gravityBadge.getBadgeCount() % 9));
        if (gravityBadge.getBadgeCount() % 9 == 0) {
            gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.TOP);
        } else if (gravityBadge.getBadgeCount() % 9 == 1) {
            gravityBadge.setBadgeGravity(Gravity.RIGHT | Gravity.BOTTOM);
        } else if (gravityBadge.getBadgeCount() % 9 == 2) {
            gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM);
        } else if (gravityBadge.getBadgeCount() % 9 == 3) {
            gravityBadge.setBadgeGravity(Gravity.RIGHT | Gravity.TOP);
        } else if (gravityBadge.getBadgeCount() % 9 == 4) {
            gravityBadge.setBadgeGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
        } else if (gravityBadge.getBadgeCount() % 9 == 5) {
            gravityBadge.setBadgeGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
        } else if (gravityBadge.getBadgeCount() % 9 == 6) {
            gravityBadge.setBadgeGravity(Gravity.CENTER);
        } else if (gravityBadge.getBadgeCount() % 9 == 7) {
            gravityBadge.setBadgeGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP);
        } else if (gravityBadge.getBadgeCount() % 9 == 8) {
            gravityBadge.setBadgeGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
        }
        break;
    }
    case R.id.visibility: {
        visibilityBadgeView
                .setVisibility(visibilityBadgeView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
        break;
    }

    default:
        break;
    }

}

From source file:com.breadwallet.BreadWalletApp.java

/**
 * Shows a custom toast using the given string as a paramater,
 *
 * @param message the message to be shown in the custom toast
 *//*from w  ww .j a  va2 s  .c om*/

public void showCustomToast(Activity app, String message, int yOffSet, int duration, int color) {
    if (toast == null)
        toast = new Toast(getApplicationContext());
    if (MainActivity.appInBackground)
        return;

    if (customToastAvailable || !oldMessage.equals(message)) {
        oldMessage = message;
        customToastAvailable = false;
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                customToastAvailable = true;
            }
        }, 1000);
        LayoutInflater inflater = app.getLayoutInflater();
        View layout = inflater.inflate(R.layout.toast, (ViewGroup) app.findViewById(R.id.toast_layout_root));
        if (color == 1) {
            layout.setBackgroundResource(R.drawable.toast_layout_black);
        }
        TextView text = (TextView) layout.findViewById(R.id.toast_text);
        text.setText(message);
        toast.setGravity(Gravity.BOTTOM, 0, yOffSet);
        toast.setDuration(duration);
        toast.setView(layout);
        toast.show();
    }
}

From source file:com.example.tt.pullrefresh.widget.CurveLayout.java

@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
    if (sheet != null) {
        throw new UnsupportedOperationException("CurveLayout must only have 1 child view");
    }/* w  ww .  j  a  v a 2s .c om*/
    sheet = child;
    sheetOffsetHelper = new ViewOffsetHelper(sheet);
    sheet.addOnLayoutChangeListener(sheetLayout);
    // force the sheet contents to be gravity bottom. This ain't a top sheet.
    ((LayoutParams) params).gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
    super.addView(child, index, params);
}

From source file:be.ugent.zeus.hydra.views.ButtonBarLayout.java

private void setStacked(boolean stacked) {
    setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
    setGravity(stacked ? Gravity.RIGHT : Gravity.BOTTOM);
    final View spacer = findViewById(android.support.v7.appcompat.R.id.spacer);
    if (spacer != null) {
        spacer.setVisibility(stacked ? View.GONE : View.INVISIBLE);
    }/*  ww w  . j  a  va2 s .  co m*/
    // Reverse the child order. This is specific to the Material button
    // bar's layout XML and will probably not generalize.
    final int childCount = getChildCount();
    for (int i = childCount - 2; i >= 0; i--) {
        bringChildToFront(getChildAt(i));
    }
}

From source file:com.boha.malengagolf.library.util.PagerTitleStrip22.java

public PagerTitleStrip22(Context context, AttributeSet attrs) {
    super(context, attrs);

    addView(mPrevText = new TextView(context));
    addView(mCurrText = new TextView(context));
    addView(mNextText = new TextView(context));

    final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
    final int textAppearance = a.getResourceId(0, 0);
    if (textAppearance != 0) {
        mPrevText.setTextAppearance(context, textAppearance);
        mCurrText.setTextAppearance(context, textAppearance);
        mNextText.setTextAppearance(context, textAppearance);
    }//from   w  w w.ja  v  a  2s .  co m
    final int textSize = a.getDimensionPixelSize(1, 0);
    if (textSize != 0) {
        setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    }
    if (a.hasValue(2)) {
        final int textColor = a.getColor(2, 0);
        mPrevText.setTextColor(textColor);
        mCurrText.setTextColor(textColor);
        mNextText.setTextColor(textColor);
    }
    mGravity = a.getInteger(3, Gravity.BOTTOM);
    a.recycle();

    mTextColor = mCurrText.getTextColors().getDefaultColor();
    setNonPrimaryAlpha(SIDE_ALPHA);

    mPrevText.setEllipsize(TruncateAt.END);
    mCurrText.setEllipsize(TruncateAt.END);
    mNextText.setEllipsize(TruncateAt.END);

    boolean allCaps = false;
    if (textAppearance != 0) {
        final TypedArray ta = context.obtainStyledAttributes(textAppearance, TEXT_ATTRS);
        allCaps = ta.getBoolean(0, false);
        ta.recycle();
    }

    if (allCaps) {
        setSingleLineAllCaps(mPrevText);
        setSingleLineAllCaps(mCurrText);
        setSingleLineAllCaps(mNextText);
    } else {
        mPrevText.setSingleLine();
        mCurrText.setSingleLine();
        mNextText.setSingleLine();
    }

    final float density = context.getResources().getDisplayMetrics().density;
    mScaledTextSpacing = (int) (TEXT_SPACING * density);
}

From source file:com.apptentive.android.sdk.module.messagecenter.view.AttachmentPreviewDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().getAttributes().windowAnimations = R.style.ApptentiveDialogAnimation;

    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(dialog.getWindow().getAttributes());
    lp.gravity = Gravity.BOTTOM;
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    lp.height = WindowManager.LayoutParams.MATCH_PARENT;
    dialog.getWindow().setAttributes(lp);
    return dialog;
}

From source file:com.slx.funstream.ui.chat.SmileKeyboard.java

public void showAtBottom() {
    showAtLocation(contentRoot.get(), Gravity.BOTTOM, 0, 0);
}