Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we increase the font size in toast?

Is there any way to increase the font size in toast without customizing?

I don't want to create a layout for increasing the text size.

Is there any way?

Thanks,

Niki

like image 640
Niki Avatar asked Mar 11 '11 14:03

Niki


People also ask

How do you change the text color on toast?

setTextColor(Color. RED); toast. show(); Just change toast text color this way..

Can we set a custom layout for a toast?

If a simple text message isn't enough, you can create a customized layout for your toast notification. To create a custom layout, define a View layout, in XML or in your application code, and pass the root View object to the setView (View) method.


2 Answers

I believe it is achieveable by this:

    ViewGroup group = (ViewGroup) toast.getView();     TextView messageTextView = (TextView) group.getChildAt(0);     messageTextView.setTextSize(25); 
like image 113
slezadav Avatar answered Oct 02 '22 16:10

slezadav


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(); 
like image 37
Anil M H Avatar answered Oct 02 '22 15:10

Anil M H