解决小米手机Toast带有应用名

解决:

        Toast toast = Toast.makeText(context, null, Toast.LENGTH_SHORT);
        toast.setText(message);
        toast.show();

封装:

public class UtilToast{

public static void shortToast(Context context,String name ){
  Toast toast = Toast.makeText(context, null, Toast.LENGTH_SHORT);
        toast.setText(name);
        toast.show();
}
public static void longToast(Context context,String name ){
  Toast toast = Toast.makeText(context, null, Toast.LENGTH_LONG);
        toast.setText(name);
        toast.show();
}
}

你可能感兴趣的:(加深学习,各种问题)