Skip to content

Instantly share code, notes, and snippets.

@omarmiatello
Created September 12, 2014 09:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omarmiatello/ae8a1ecb89d04407e102 to your computer and use it in GitHub Desktop.
Save omarmiatello/ae8a1ecb89d04407e102 to your computer and use it in GitHub Desktop.
public void showToastOver(View view, String text) {
Toast toast = Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT);
int xOffset = view.getLeft() - (view.getWidth() / 2);
int yOffset = view.getHeight();
toast.setGravity(Gravity.LEFT | Gravity.BOTTOM, xOffset, yOffset);
Log.d("toast", String.format("Left %d Top %d Bottom %d", view.getLeft(), view.getTop(), view.getBottom()));
toast.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment