List of usage examples for android.view Gravity CENTER_VERTICAL
int CENTER_VERTICAL
To view the source code for android.view Gravity CENTER_VERTICAL.
Click Source Link
From source file:Main.java
public static void showToast(Context context, String text, int duration) { Toast toast = Toast.makeText(context, text, duration); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show();//from w w w . ja v a2 s .c o m }
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_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show();// www. j ava2 s . com }
From source file:Main.java
public final static void showToastMessage(Context context, String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.show();//from w w w . j a va 2 s . c o m }
From source file:Main.java
public static void centerToast(Context context, String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0); toast.show();// ww w . ja v a 2 s . c o m }
From source file:Main.java
private static void getToast(int duration) { if (mToast == null) { mToast = new Toast(mContext); mToast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); mToast.setDuration(duration);/*from w ww . ja v a 2 s. c o m*/ } }
From source file:Main.java
@SuppressLint("ShowToast") public static Toast createToast(Context context, String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0); return toast; }
From source file:Main.java
static void preDraw(TextView view, Canvas canvas) { Drawable[] drawables = view.getCompoundDrawables(); if (drawables[0] != null) { view.setGravity(Gravity.CENTER_VERTICAL | Gravity.START); onCenterDraw(view, canvas, drawables[0], Gravity.START); } else if (drawables[1] != null) { view.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP); onCenterDraw(view, canvas, drawables[1], Gravity.TOP); } else if (drawables[2] != null) { view.setGravity(Gravity.CENTER_VERTICAL | Gravity.END); onCenterDraw(view, canvas, drawables[2], Gravity.END); } else if (drawables[3] != null) { view.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); onCenterDraw(view, canvas, drawables[3], Gravity.BOTTOM); }//from ww w .j a v a 2s . c o m }
From source file:Main.java
public static void preDraw(TextView view, Canvas canvas) { Drawable[] drawables = view.getCompoundDrawables(); if (drawables != null) { if (drawables[0] != null) { view.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); onCenterDraw(view, canvas, drawables[0], Gravity.LEFT); } else if (drawables[1] != null) { view.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP); onCenterDraw(view, canvas, drawables[1], Gravity.TOP); } else if (drawables[2] != null) { view.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT); onCenterDraw(view, canvas, drawables[2], Gravity.RIGHT); } else if (drawables[3] != null) { view.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); onCenterDraw(view, canvas, drawables[3], Gravity.BOTTOM); }/*from ww w .j a v a2 s.c om*/ } }
From source file:Main.java
public static void showToast(final Activity activity, final String message) { activity.runOnUiThread(new Runnable() { @Override// w w w.j a v a 2s . c om public void run() { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.BOTTOM, 0, 80); toast.show(); } }); }
From source file:Main.java
public static void showHint(final Context c, String hintText, boolean makeItAQuickOne) { int duration = makeItAQuickOne ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG; Toast t = Toast.makeText(c, hintText, duration); t.setGravity(Gravity.CENTER_VERTICAL, 0, 0); t.show();/* w ww .j av a 2 s .c o m*/ }