Example usage for android.view Gravity CENTER

List of usage examples for android.view Gravity CENTER

Introduction

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

Prototype

int CENTER

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

Click Source Link

Document

Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.

Usage

From source file:Main.java

public static void showToast(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from w  w w  .  jav  a 2  s  .  com
}

From source file:Main.java

public static void showToast(String message, Context context) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from w  w  w. ja  v  a 2 s.c o m*/
}

From source file:Main.java

public static void showLongToast(Context context, String string) {
    Toast toast = Toast.makeText(context, string, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from   ww w.j  a va 2  s .  c  o m
}

From source file:Main.java

public static void toastInMiddle(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from   ww w.  j av a2 s.  c o  m*/
}

From source file:Main.java

public static boolean showErrorToastCenter(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from   w w  w.  ja va 2 s  . co m
    return false;
}

From source file:Main.java

public static void showToast(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from ww w . j a  v a2 s .c o m*/
}

From source file:Main.java

public static void ShowToastMessage(Context mContext, String xMessage) {
    Toast mToast = Toast.makeText(mContext, xMessage, Toast.LENGTH_SHORT);
    mToast.setGravity(Gravity.CENTER, 0, 0);
    mToast.show();//from w w  w  .j  a  v  a  2 s.  c  o m
}

From source file:Main.java

public static void showMessage(Context context, String msg) {
    Toast toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from w  ww .  ja  v  a2  s  .  c om*/
}

From source file:Main.java

public static void DisplayToast(Context context, String text) {
    Toast toast;//  ww w.ja  v a 2 s  .com
    toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}

From source file:Main.java

public static void showToastShort(Context context, String message) {
    Toast toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();// ww w  .j  av a  2 s  .c om
}