Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent toast frame

How to set transparent toast frame in android ? I want to it more transparent.

like image 451
Cuong Ta Avatar asked Aug 09 '10 07:08

Cuong Ta


1 Answers

You can set the background used for the Toast using the code below.

Toast toast = Toast.makeText(context, "Toast text", Toast.LENGTH_SHORT);
View view = toast.getView();
view.setBackgroundResource(/*your background resid*/);
toast.setView(view);
toast.show();

Basically you create the toast with makeText and then get the view set up by Android. Change the background for the view and then set the view back.

By using a background with a more transparent background than the default one you can get the effect you want.

like image 125
Key Avatar answered Nov 18 '22 04:11

Key