Closed yangtuhua closed 6 years ago
ToastUtils.setGravity(Gravity.CENTER, 0, 0); View toastView = ToastUtils.showCustomShort(R.layout.toast_center_long); TextView tvTips = toastView.findViewById(R.id.tv_tips); tvTips.setText(msg);
new Handler().post(new Runnable() { @Override public void run() { ToastUtils.setGravity(Gravity.BOTTOM, 0, 0);//此行代码不起作用,下次吐丝还是在Center } });
看demo,你这什么逻辑啊,前面设置了center,show出来了肯定是在中间了啊,你后面设置了底部,为啥不再show呢,不show会变?
ToastUtils.setGravity(Gravity.CENTER, 0, 0); View toastView = ToastUtils.showCustomShort(R.layout.toast_center_long); TextView tvTips = toastView.findViewById(R.id.tv_tips); tvTips.setText(msg);