【发布时间】:2015-05-06 10:25:41
【问题描述】:
我有一个Custom Toast,我希望它显示 10 秒
这是我的代码:
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast,
(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("please wait.... ");
text.setTypeface(type);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(10000);
toast.setView(layout);
toast.show();
但通过设置toast.setDuration(10000); 不起作用
有谁知道我的代码有什么问题或者我该如何以另一种方式做到这一点?
【问题讨论】:
标签: android duration android-toast