Skip to content

Instantly share code, notes, and snippets.

@liangfeidotme
Created June 6, 2016 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liangfeidotme/78006d1e2e92aea18355610e33773c79 to your computer and use it in GitHub Desktop.
Save liangfeidotme/78006d1e2e92aea18355610e33773c79 to your computer and use it in GitHub Desktop.
Customize an Android Toast
final Toast toast = new Toast(context);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
LayoutInflater inflater = LayoutInflater.from(context);
toast.setView(inflater.inflate(R.layout.leak_canary_heap_dump_toast, null));
toast.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment