Search code examples
androidtoastkindle-fire

How can I change the Toast notification on Kindle Fire to be white text on black background?


The default color of the Toast on the Kindle Fire is black text on a white background. I followed the instructions in this answer to try to set the text color to white and background color to black, but after these changes, there's still white showing behind the background so it looks like white text on a black background on a white background. Is there some other field I need to set the get the entire background black? Here's my code:

  Context context = ctx.getApplicationContext();
  CharSequence text = "Toasty text...";
  int duration = Toast.LENGTH_SHORT;

  Toast toast = Toast.makeText(context, text, duration);
  TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
  v.setTextColor(Color.WHITE);
  v.setBackgroundColor(Color.BLACK);
  toast.show();

edit: I ended up doing a combination of CommonsWare's answer and this link to create the default toast and set the color.


Solution

  • Instead of using the static makeText() method, you could try using the regular constructor and then using setView() with your own custom layout for the Toast.