Android Toast居中显示方法一请看 Android Toast设置居中显示方法一-CSDN博客
下面来讲讲第二种方法:
Toast toast = Toast.makeText(MainActivity.this, "my toast", Toast.LENGTH_SHORT);LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.WRAP_CONTENT,Gravity.CENTER);View toastView = toast.getView();toastView.setLayoutParams(layoutParams);toast.setGravity(Gravity.CENTER, 0, 0); //居中显示toast.show();