Java Code Examples for com.blankj.utilcode.util.ToastUtils#setView()
The following examples show how to use
com.blankj.utilcode.util.ToastUtils#setView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToastActivity.java From Android-UtilCode with Apache License 2.0 | 4 votes |
@Override public void onWidgetClick(View view) { switch (view.getId()) { case R.id.btn_toggle_location: if (isDefaultLocation) { ToastUtils.setGravity(Gravity.CENTER, 0, 0); } else { ToastUtils.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, getResources().getDimensionPixelSize(R.dimen.offset_64)); } isDefaultLocation = !isDefaultLocation; break; case R.id.btn_toggle_view: if (isDefaultView) { ToastUtils.setView(R.layout.toast_custom); } else { ToastUtils.setView(null); } isDefaultView = !isDefaultView; break; case R.id.btn_show_short_toast_safe: new Thread(new Runnable() { @Override public void run() { ToastUtils.showShortSafe(R.string.toast_short_safe); } }).start(); break; case R.id.btn_show_long_toast_safe: new Thread(new Runnable() { @Override public void run() { ToastUtils.showLongSafe(R.string.toast_long_safe); } }).start(); break; case R.id.btn_show_short_toast: ToastUtils.showShort(R.string.toast_short); break; case R.id.btn_show_long_toast: ToastUtils.showShort(R.string.toast_long); break; case R.id.btn_cancel_toast: ToastUtils.cancel(); break; } tvAboutToast.setText("is default location: " + isDefaultLocation + "\nis default view: " + isDefaultView ); }
Example 2
Source File: ToastActivity.java From Android-UtilCode with Apache License 2.0 | 4 votes |
@Override protected void onDestroy() { ToastUtils.setView(null); super.onDestroy(); }