I want to create a toast message with background color is white and message color is black. My toast message is:
Toast.makeText(Logpage.this, \"Please Give
I was able to do it by setting the background color filter color and finding the toast resource ID and setting the text color.
Android.Graphics.Color
/// Creates and displays a toast with the given text.
public void Show(string message)
{
// Create the toast.
Toast toast = Toast.MakeText(Android.App.Application.Context, message, ToastLength.Long);
// Set the background color.
Android.Graphics.Color c = new Android.Graphics.Color(122, 193, 66, 255);
Android.Graphics.ColorMatrixColorFilter CMF = new Android.Graphics.ColorMatrixColorFilter(new float[]
{
0,0,0,0,(float)c.R,
0,0,0,0,(float)c.G,
0,0,0,0,(float)c.B,
0,0,0,1,0
});
toast.View.Background.SetColorFilter(CMF);
// Set the text color.
toast.View.FindViewById(Android.Resource.Id.Message).SetTextColor(new Android.Graphics.Color(0, 55, 103, 255));
// Display the toast.
toast.Show();
}