Closed sooner0493 closed 7 years ago
?不知道你在说什么
抱歉 没表达清 我是说自定义view时传入的layout里面有TextView,如何给这个TextView赋值呢 ?
getView().findViewById(id)
是这样? ((TextView) ToastUtils.getView().findViewById(R.id.message)).setText(words); ToastUtils.showShort(words);
ToastUtils.showCustomLong(R.layout.toast_custom);
TextView tvMessage = (TextView) ToastUtils.getView().findViewById(R.id.tv_toast_message);
tvMessage.setText(getString(R.string.toast_custom_view));
好吧 谢谢。。。
private static void show(CharSequence text, int duration) { cancel(); if (customView != null) { sToast = new Toast(Utils.getContext()); sToast.setView(customView); sToast.setDuration(duration); } else { sToast = Toast.makeText(Utils.getContext(), text, duration); } sToast.setGravity(gravity, xOffset, yOffset); sToast.show(); } 请问这个如何设置显示的text内容?谢谢