//创建ToastDialog
ToastDialog dialog =new ToastDialog(getContext());
//设置显示位置 顶 底 左 右
dialog.setAlignment(LayoutAlignment.BOTTOM);
//设置显示的文字,可自定义component
dialog.setText(msg);
//设置显示时长 最多2秒
dialog.setDuration(2000);
//设置自定义component
Component toastLayout = LayoutScatter.getInstance(this).parse(ResourceTable.Layout_toast,null,false);
dialog.setComponent(toastLayout);
//展示toastDialog
dialog.show();
参考网址https://www.jianshu.com/p/368b9b0ab586
scatter 散射 instance 实例 parse 解析
component 元件 toast 土司