tomasslavicek

C# Xamarin Android Toast

Oct 3rd, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. /// <summary>
  2. /// Zobrazí zvětšenou toast notifikaci (nahoře uprostřed obrazovky)
  3. /// - volání: Operations.ShowToast(Engine.Lang.Get("msg_delivered"));
  4. /// </summary>
  5. public static void ShowToast(string text)
  6. {
  7.     // Vytvoří, zvětší toast, zobrazí ho
  8.     var toast = Toast.MakeText(Application.Context, text, ToastLength.Long);
  9.  
  10.     LinearLayout toastLayout = (LinearLayout)toast.View;
  11.     TextView toastTV = (TextView)toastLayout.GetChildAt(0);
  12.     toastTV.SetTextSize(ComplexUnitType.Dip, 30);
  13.     toast.SetGravity(GravityFlags.CenterHorizontal, 0, -100);
  14.     toast.Show();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment