public override void OnWindowFocusChanged(bool hasFocus) { base.OnWindowFocusChanged(hasFocus); ToolTip.Builder builder = new ToolTip.Builder(this, _textView, _rootLayout, _tip_text, ToolTip.PositionAbove); builder.SetAlign(_align); _toolTipsManager.Show(builder.Build()); }
public void ShowTooltip(Xamarin.Forms.View onView, TooltipConfig config) { var control = GetOrCreateRenderer(onView).View; if (!string.IsNullOrEmpty(config.Text)) { ToolTip.Builder builder; var position = config.Position; var parentContent = control.RootView; switch (position) { case TooltipPosition.Top: builder = new ToolTip.Builder(global::Android.App.Application.Context, control, parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionAbove); break; case TooltipPosition.Left: builder = new ToolTip.Builder(global::Android.App.Application.Context, control, parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionLeftTo); break; case TooltipPosition.Right: builder = new ToolTip.Builder(global::Android.App.Application.Context, control, parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionRightTo); break; default: builder = new ToolTip.Builder(global::Android.App.Application.Context, control, parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionBelow); break; } builder.SetAlign(ToolTip.AlignLeft); builder.SetBackgroundColor(config.BackgroundColor.ToAndroid()); builder.SetTextColor(config.TextColor.ToAndroid()); toolTipView = builder.Build(); _toolTipsManager?.Show(toolTipView); } }
void ShowChartsTooltip() { var Listener = this.Activity as ITipListener; var ToolTips = new ToolTipsManager(); var builder = new ToolTip.Builder(this.btnCountryCharts.Context, this.btnCountryCharts, this.LinearRoot, "¡Nuevo!", ToolTip.PositionBelow); builder.SetAlign(ToolTip.AlignCenter); builder.SetBackgroundColor(Resource.Color.material_grey_50); Task.Delay(2000).ContinueWith((task) => this.Activity.RunOnUiThread(() => ToolTips.Show(builder.Build()))); }