| | |
| | | import android.content.Context; |
| | | import android.view.Gravity; |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | public class ToastUtil { |
| | | |
| | | public static void showMiddleToast(Context context, View view, int duration) { |
| | | public static Toast showMiddleToast(Context context, View view, int duration) { |
| | | Toast toast = new Toast(context); |
| | | toast.setView(view); |
| | | toast.setDuration(duration); |
| | | toast.setGravity(Gravity.CENTER,0,0); |
| | | toast.setGravity(Gravity.CENTER, 0, 0); |
| | | toast.show(); |
| | | return toast; |
| | | } |
| | | |
| | | |
| | | public static Toast showGetGoldGornToast(Context context, String text) { |
| | | Toast toast = new Toast(context); |
| | | TextView textView = new TextView(context); |
| | | textView.setText(text); |
| | | toast.setView(textView); |
| | | toast.setDuration(Toast.LENGTH_SHORT); |
| | | toast.setGravity(Gravity.CENTER, 0, 0); |
| | | toast.show(); |
| | | return toast; |
| | | } |
| | | |
| | | } |