How can we increase the font size in toast?
Solution 1:
I believe it is achieveable by this:
ViewGroup group = (ViewGroup) toast.getView();
TextView messageTextView = (TextView) group.getChildAt(0);
messageTextView.setTextSize(25);
Solution 2:
this is ...
Toast toast = Toast.makeText(context, R.string.yummyToast, Toast.LENGTH_SHORT);
//the default toast view group is a relativelayout
RelativeLayout toastLayout = (RelativeLayout) toast.getView();
TextView toastTV = (TextView) toastLayout.getChildAt(0);
toastTV.setTextSize(30);
toast.show();
Solution 3:
Here is how to do that with spans:
SpannableStringBuilder biggerText = new SpannableStringBuilder(text);
biggerText.setSpan(new RelativeSizeSpan(1.35f), 0, text.length(), 0);
Toast.makeText(context, biggerText, Toast.LENGTH_LONG).show();