Search code examples
androidandroid-layouttoast

Android: How to set the colour of a Toast's text


I am displaying a toast message as the result of an if statement using the following code:

Toast.makeText(getBaseContext(), "Please Enter Price", Toast.LENGTH_SHORT).show();

It is displayed as white text on a white background, as such it can not be read! My question is, how can I change the colour of the toast's text?


Solution

  • You can create a custom Toast view to suit your requirements. See the section titled "Creating a Custom Toast View" at http://developer.android.com/guide/topics/ui/notifiers/toasts.html