import android.content.Context; 4 import android.widget.Toast; 5 6 public class ToastUtils { 7 8 private static Toast mToast; 9 10 public static void show(Context ctx, String text) { 11 if (mToast == null) { 12 mToast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT); 13 } else { 14 mToast.setText(text); 15 } 16 mToast.show(); 17 } 18 }
如果是自定的布局也是一样.
转载请注明出处:www.cnblogs.com/fangyucun