protected override void DrawTooltip(Canvas canvas, TooltipView tooltipView) { base.DrawTooltip(canvas, tooltipView); Bitmap bitmap = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.grain); bitmap = Bitmap.CreateScaledBitmap(bitmap, (int)(40 * context.Resources.DisplayMetrics.Density), (int)(33.33f * context.Resources.DisplayMetrics.Density), false); canvas.DrawBitmap(bitmap, (tooltipView.LabelRect.Left + 3.5f) * context.Resources.DisplayMetrics.Density, (tooltipView.LabelRect.Top + 3.5f) * context.Resources.DisplayMetrics.Density, null); }
private TooltipView AddTooltipView(Tooltip tooltip, View targetView) { TooltipView tooltipView = new TooltipView(Context); tooltipView.SetTooltip(tooltip, targetView); AddView(tooltipView); return(tooltipView); }
void Start(){ if (tooltip == null) { foreach(TooltipView t in GameObject.FindObjectsOfType<TooltipView>()){ if (t != null){ tooltip = t; break; } } } }
protected override void Awake() { base.Awake(); if (Instance == null) { Instance = this; } this._camera = Camera.main; }
protected override View GetView(TooltipView p0) { ImageView imageView = new ImageView(context); imageView.SetImageResource(Resource.Drawable.grain); LinearLayout rootLayout = new LinearLayout(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); rootLayout.Orientation = Orientation.Horizontal; rootLayout.LayoutParameters = layoutParams; rootLayout.SetPadding(5, 5, 5, 5); rootLayout.AddView(imageView); TextView xLabel = new TextView(context); xLabel.Text = (p0.ChartDataPoint as DataPoint).XValue.ToString(); xLabel.TextSize = 12; xLabel.SetTextColor(Color.ParseColor("#FFA500")); TextView yLabel = new TextView(context); yLabel.Text = (p0.ChartDataPoint as DataPoint).YValue.ToString() + "M"; yLabel.TextSize = 15; yLabel.SetTextColor(Color.White); LinearLayout layout = new LinearLayout(context); LinearLayout.LayoutParams linearlayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); layout.Orientation = Orientation.Vertical; linearlayoutParams.SetMargins(10, 10, 10, 10); layout.LayoutParameters = linearlayoutParams; layout.AddView(xLabel); layout.AddView(yLabel); rootLayout.AddView(layout); p0.AddView(rootLayout); return(p0); }
public void SetUp() { tooltipView = TooltipView.Create(); }
protected override View GetView(TooltipView p0) { LinearLayout rootLayout = new LinearLayout(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); rootLayout.Orientation = Orientation.Vertical; rootLayout.LayoutParameters = layoutParams; rootLayout.SetPadding(10, 5, 5, 5); rootLayout.SetBackgroundColor(Color.ParseColor("#404041")); TextView label = new TextView(context); label.Text = (p0.ChartDataPoint as DataPoint).Label.ToString(); label.TextSize = 12; label.TextAlignment = Android.Views.TextAlignment.Center; label.SetPadding(150, 0, 0, 0); label.SetTextColor(Color.White); LinearLayout line = new LinearLayout(context); LinearLayout.LayoutParams linelayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, 4); line.LayoutParameters = linelayoutParams; line.SetBackgroundColor(Color.White); LinearLayout xLayout = new LinearLayout(context); xLayout.Orientation = Orientation.Horizontal; xLayout.SetPadding(0, 5, 0, 0); TextView xLabel = new TextView(context); xLabel.Text = "Literacy Rate : "; xLabel.TextSize = 12; xLabel.SetTextColor(Color.ParseColor("#CCCCCC")); TextView xValue = new TextView(context); xValue.Text = (p0.ChartDataPoint as DataPoint).XValue + "%"; xValue.TextSize = 12; xValue.SetTextColor(Color.White); xLayout.AddView(xLabel); xLayout.AddView(xValue); LinearLayout yLayout = new LinearLayout(context); yLayout.Orientation = Orientation.Horizontal; yLayout.SetPadding(0, 5, 0, 0); TextView yLabel = new TextView(context); yLabel.Text = "GDP Growth Rate : "; yLabel.TextSize = 12; yLabel.SetTextColor(Color.ParseColor("#CCCCCC")); TextView yValue = new TextView(context); yValue.Text = (p0.ChartDataPoint as DataPoint).YValue.ToString(); yValue.TextSize = 12; yValue.SetTextColor(Color.White); yLayout.AddView(yLabel); yLayout.AddView(yValue); LinearLayout sizeLayout = new LinearLayout(context); sizeLayout.Orientation = Orientation.Horizontal; sizeLayout.SetPadding(0, 5, 0, 0); TextView sizeLabel = new TextView(context); sizeLabel.Text = "Population : "; sizeLabel.TextSize = 12; sizeLabel.SetTextColor(Color.ParseColor("#CCCCCC")); TextView sizeValue = new TextView(context); sizeValue.Text = (p0.ChartDataPoint as DataPoint).Size + " Billion"; sizeValue.TextSize = 12; sizeValue.SetTextColor(Color.White); sizeLayout.AddView(sizeLabel); sizeLayout.AddView(sizeValue); rootLayout.AddView(label); rootLayout.AddView(line); rootLayout.AddView(xLayout); rootLayout.AddView(yLayout); rootLayout.AddView(sizeLayout); p0.AddView(rootLayout); return(p0); }
void Awake() { instance = this; HideTooltip(); }
protected override View GetView(TooltipView p0) { LinearLayout rootLayout = new LinearLayout(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); rootLayout.Orientation = Orientation.Vertical; rootLayout.LayoutParameters = layoutParams; rootLayout.SetPadding(10, 5, 5, 5); TextView label = new TextView(context); label.Text = p0.Series.Label; label.TextSize = 12; label.TextAlignment = Android.Views.TextAlignment.Center; label.SetPadding(80, 0, 0, 0); label.SetTextColor(Color.White); LinearLayout line = new LinearLayout(context); LinearLayout.LayoutParams linelayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, 4); line.LayoutParameters = linelayoutParams; line.SetBackgroundColor(Color.White); LinearLayout xLayout = new LinearLayout(context); xLayout.Orientation = Orientation.Horizontal; xLayout.SetPadding(0, 5, 0, 0); TextView xLabel = new TextView(context); xLabel.Text = "Height : "; xLabel.TextSize = 12; xLabel.SetTextColor(Color.ParseColor("#CCCCCC")); TextView xValue = new TextView(context); xValue.Text = (p0.ChartDataPoint as DataPoint).XValue.ToString(); xValue.TextSize = 12; xValue.SetTextColor(Color.White); xLayout.AddView(xLabel); xLayout.AddView(xValue); LinearLayout yLayout = new LinearLayout(context); yLayout.Orientation = Orientation.Horizontal; yLayout.SetPadding(0, 5, 0, 0); TextView yLabel = new TextView(context); yLabel.Text = "Weight : "; yLabel.TextSize = 12; yLabel.SetTextColor(Color.ParseColor("#CCCCCC")); TextView yValue = new TextView(context); yValue.Text = (p0.ChartDataPoint as DataPoint).YValue + " lbs"; yValue.TextSize = 12; yValue.SetTextColor(Color.White); yLayout.AddView(yLabel); yLayout.AddView(yValue); rootLayout.AddView(label); rootLayout.AddView(line); rootLayout.AddView(yLayout); rootLayout.AddView(xLayout); p0.AddView(rootLayout); return(p0); }