Created
November 5, 2013 20:16
-
-
Save ChrisRisner/7325444 to your computer and use it in GitHub Desktop.
Good vs Demo Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Toast toast = Toast.makeText(this, "This is a toast that is centered onscreen and the text is centered in the toast", Toast.LENGTH_SHORT); | |
LinearLayout layout = (LinearLayout) toast.getView(); | |
TextView tv = (TextView) layout.getChildAt(0); | |
tv.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); | |
toast.setGravity(Gravity.CENTER, 0, 0); | |
toast.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment