}
public static void showMyToast(final Toast toast, final int cnt) {
final Timer timer =new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
LogPlus.e(“lgq”,“收尾。。show。。”);
toast.show();
}
},0,3000);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
toast.cancel();
timer.cancel();
}
}, cnt );
}
}
调用
//自定义显示时间
ToastUtil.showToast(MainActivity.this, “失败”, R.mipmap.ic_failure,30000);
简易Toast工具方法2
============
private void displayToastTip(final String tip) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SfzShiBieActivity.this, tip, Toast.LENGTH_SHORT).show();
}
});
}
private void toast(final String text) {
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(RegActivity.this, text, Toast.LENGTH_LONG).show();
}
});
}
private Handler handler = new Handler(Looper.getMainLooper());
背景资源
1、#999999
2、
<?xml version="1.0" encoding="utf-8"?><stroke
android:width=“2px”
android:color=“@color/numtext” />
<corners
android:radius=“8dp”/>
<padding
androi