1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| using System;
| using Android.Views;
| using Android.Widget;
|
| namespace Shared
| {
| public class Tip
| {
| public Tip()
| {
| this.BackgroundColor = 0xff323232;
| this.CloseTime = 2;
| this.MaxWidth = 100;
| }
| public int CloseTime {
| get;
| set;
| }
|
| public string Text {
| get;
| set;
| }
|
| public AMPopTipDirection Direction {
| get;
| set;
| }
|
| public int MaxWidth {
| get;
| set;
| }
|
| public uint BackgroundColor {
| get;
| set;
| }
|
|
| /// <summary>
| /// 点击哪个View时显赫提示
| /// </summary>
| public void Show(View view)
| {
| Display display = Application.Activity.WindowManager.DefaultDisplay;
| // 获取屏幕高度
| Toast toast = Toast.MakeText (Application.Activity, Text, ToastLength.Long);
| // 这里给了一个1/4屏幕高度的y轴偏移量
| toast.SetGravity (GravityFlags.Center, 0, 0);
| toast.Show ();
|
|
| //popTip.ShowText (this.Text,Direction,MaxWidth, Application.MainUIViewController.View, view.RealView.ConvertRectToView(view.RealView.Bounds,Application.MainUIViewController.View),CloseTime);
| }
|
|
| }
|
| }
|
|