Muddz Muddz - 1 year ago 125
Android Question

How to define a Toast style in style.xml?

Can a

be styled in
like we do for Activity themes?

I want to style the following:

  • Text color

  • Text Size

  • Text font

  • Background color/opacity

  • Background Radius of corners and sizes

I can't find anything that relates to Toast on the web or in the style.xml

I have solved it by making an StyleableToast class which you can easily use to style your Toasts in almost any way! See answer here:

Answer Source

Since there was not an easy and a non messy way (layouts,inflating etc) to style a Toast, I decicided then to make a complete Styleable Toast class with a lot of styling possibilities!

I will keep improve the Styleable Toast class and make it feature rich and release it in the jCenter() so it can be added as an dependency

Here is it. Just a single class you put in your project:

Examples of toasts made with StyleableToast:

enter image description here

All feedback and feature requests is welcome!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download