public void OnClick (View v) { //get root layout PopoverView popoverView = new PopoverView (this, Resource.Layout.popover_showed_view); popoverView.setContentSizeForViewInPopover (new Point (320, 340)); popoverView.Del = this; popoverView.showPopoverFromRectInViewGroup (rootView, PopoverView.getFrameForView (v), PopoverView.PopoverArrowDirectionAny, true); ViewGroup view = (ViewGroup)popoverView.Superview; string str = ""; if (main == null) { main = view; str = "Hello"; } else { view = main; str = "Hello1"; } TextView txt = view.FindViewById<TextView> (Resource.Id.textView1); txt.Text = str; txt.Click += (object sender, EventArgs e) => { Console.WriteLine ("Hello"); }; }
//******************************************************************** // PUBLIC METHODS //******************************************************************** /** * This method shows a popover in a ViewGroup, from an origin rect (relative to the Application Window) * @param group The group we want to insert the popup. Normally a Relative Layout so it can stand on top of everything * @param originRect The rect we want the popup to appear from (relative to the Application Window!) * @param arrowDirections The mask of bits to tell in which directions we want the popover to be shown * @param animated Whether is animated, or not */ public void showPopoverFromRectInViewGroup(ViewGroup group, Rect originRect, int arrowDirections, bool animated) { //First, tell delegate we will show if (del != null) { del.popoverViewWillShow(this); } //Save superview Superview = group; //First, add the view to the view group. The popover will cover the whole area LayoutParams insertParams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); group.AddView(this, insertParams); //Now, save rect for the layout (is the same as the superview) popoverLayoutRect = PopoverView.getFrameForView(Superview); //Add available rects addAvailableRects(originRect, arrowDirections); //Get best rect int best = getBestRect(); //Add popover // Rect bestRect = possibleRects.get(best); Rect bestRect = null; possibleRects.TryGetValue(best, out bestRect); addPopoverInRect(bestRect); //Add arrow image addArrow(originRect, best); //If we don't want animation, just tell the delegate if (!animated) { //Tell delegate we did show if (del != null) { del.popoverViewDidShow(this); } } //If we want animation, animate it! else { //Continue only if we are not animating if (!isAnimating) { //Create alpha animation, with its listener AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f); animation.Duration = fadeAnimationTime; animation.AnimationStart += (object sender, Animation.AnimationStartEventArgs e) => { }; animation.AnimationRepeat += (object sender, Animation.AnimationRepeatEventArgs e) => { }; animation.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => { //End animation isAnimating = false; //Tell delegate we did show if (del != null) { del.popoverViewDidShow(this); } }; //Start animation isAnimating = true; StartAnimation(animation); } } }
public void popoverViewDidDismiss (PopoverView view) { Log.Info ("POPOVER", "Did dismiss"); }
public void popoverViewWillDismiss (PopoverView view) { Log.Info ("POPOVER", "Will dismiss"); }
public void popoverViewDidShow (PopoverView view) { Log.Info ("POPOVER", "Did show"); }
public void popoverViewWillShow (PopoverView view) { Log.Info ("POPOVER", "Will show"); }