public void showToast()
{
String msg = "To the bride and groom!";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(this, msg, duration);
int offsetX = 0;
int offsetY = 0;
//设置位置
toast.setGravity(Gravity.BOTTOM, offsetX, offsetY);
//设置自定义视图
LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.toast_view, null);
toast.setView(view);
//显示
toast.show();
}
运行测试