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 c, String str) {
    Toast toast = Toast.makeText(c, str, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, toast.getXOffset() / 2, toast.getYOffset() / 2);
    toast.show();/*  w  ww. j  ava 2 s.  c  o m*/
}

From source file:Main.java

public static void show(Context context, String info) {
    Toast t = Toast.makeText(context, info, Toast.LENGTH_LONG);
    t.setGravity(Gravity.CENTER, 0, 0);
    t.show();
}

From source file:Main.java

public static void showMiddleToast(Context cxt, String msg) {
    Toast toast = Toast.makeText(cxt, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from   w w w  .  j a  va2s  .  com
}

From source file:Main.java

public static void toast(String message, Context context) {
    Toast msg = Toast.makeText(context, message, Toast.LENGTH_LONG);
    msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
    msg.show();//ww w . ja va  2 s  . c o  m
}

From source file:Main.java

public static void showToast(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. j  a  v a 2 s.c o m*/
}

From source file:Main.java

public static void infoAlert(Activity activity, String msg) {
    Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from ww w  .j a v a2 s.  c om
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context ctx, String message) {
    Toast tost = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    tost.setGravity(Gravity.CENTER, 0, 0);
    tost.show();//w ww .  j  a v  a  2  s .  com
}

From source file:Main.java

public static void showLToast(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*  w  ww . j  a va2 s.  c o  m*/
}

From source file:Main.java

public static void showToast(Context context, String string) {
    Toast toast = Toast.makeText(context, string, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from   www. j a  v  a  2 s .co  m*/
}