当前位置: 首页>>代码示例>>C#>>正文


C# View.GetY方法代码示例

本文整理汇总了C#中Android.Views.View.GetY方法的典型用法代码示例。如果您正苦于以下问题:C# View.GetY方法的具体用法?C# View.GetY怎么用?C# View.GetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Views.View的用法示例。


在下文中一共展示了View.GetY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnItemClick

		public void OnItemClick(AdapterView parent, View view, int position, long id)
		{
			Meat meat = mAdapter [position];
			Log.Info (TAG, meat.title + " clicked. Replacing fragment.");
			// We start the fragment transaction here. It is just an ordinary fragment transaction.
			Activity.SupportFragmentManager
				.BeginTransaction ()
				.Replace (Resource.Id.sample_content_fragment,
					DetailFragment.NewInstance (meat.resourceId, meat.title,
						(int)view.GetX (), (int)view.GetY (),
						view.Width, view.Height)
				)
				// We push the fragment transaction to back stack. User can go back to the
				// previous fragment by pressing back button.
				.AddToBackStack ("detail")
				.Commit ();
		}
开发者ID:EssMarkus,项目名称:monodroid-samples,代码行数:17,代码来源:FragmentTransitionFragment.cs

示例2: OnTouch

        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action)
            {
                case MotionEventActions.Down:
                    _viewX = v.GetX() - e.RawX;
                    _viewY = v.GetY() - e.RawY;

                    break;
                case MotionEventActions.Move:

                    v.Animate()
                        .X(e.RawX + _viewX)
                       .Y(e.RawY + _viewY)
                       .SetDuration(0)
                       .Start();
                    break;
                default: return false;

            }
            return true;
        }
开发者ID:knervous,项目名称:MemoryBox,代码行数:22,代码来源:Memories.cs

示例3: GetY

 public static float GetY(View view)
 {
     return view.GetY();
 }
开发者ID:andyci,项目名称:ShowcaseView,代码行数:4,代码来源:AnimationUtils.cs

示例4: GetFretMetrics

        /// <summary>
        /// Gets the X, Y, Width, and Height of the fret which is represented on the screen by a view.
        /// </summary>
        /// <param name="fretNum">The number of the requested fret.</param>
        /// <returns>Returns the metrics of the requested fret.</returns>
        private FretMetrics GetFretMetrics(GuitarFret fretNum)
        {
            //Initialize a dummy fret.
            View fret = new View(_currentActivity);

            //Get the correct fret number.
            /*if (_currentActivity.Title == "TutorActivity")

            else if (_currentActivity.Title == "PlayerActivity")

            else if (_currentActivity.Title == "RecorderActivity")*/

            switch (fretNum)
            {
                case GuitarFret.OpenString:
                        fret = _currentActivity.FindViewById(Resource.Id.openString);
                    break;
                case GuitarFret.Fret1:
                        fret = _currentActivity.FindViewById(Resource.Id.fret1);
                    break;
                case GuitarFret.Fret2:
                        fret = _currentActivity.FindViewById(Resource.Id.fret2);
                    break;
                case GuitarFret.Fret3:
                        fret = _currentActivity.FindViewById(Resource.Id.fret3);
                    break;
                case GuitarFret.Fret4:
                        fret = _currentActivity.FindViewById(Resource.Id.fret4);
                    break;
                case GuitarFret.Fret5:
                        fret = _currentActivity.FindViewById(Resource.Id.fret5);
                    break;
                case GuitarFret.Fret6:
                        fret = _currentActivity.FindViewById(Resource.Id.fret6);
                    break;
            }

            //Get the X & Y coordinates of the fret on the screen.
            int[] coordinates = new int[2];
            fret.GetLocationInWindow(coordinates);

            //Summerize X, Y, Width, and Height.
            FretMetrics metrics = new FretMetrics(
                (int)fret.GetX(), //coordinates[0],
                (int)((TableRow)fret.Parent).GetY(), //coordinates[1],
                fret.MeasuredWidth,
                fret.MeasuredHeight);

            Log.Info("", fret.Tag.ToString());
            Log.Info(fret.GetX().ToString(), fret.GetY().ToString());
            Log.Info(coordinates[0].ToString(), coordinates[1].ToString());
            Log.Info(fret.Width.ToString(), fret.Height.ToString());
            Log.Info("Left", fret.Left.ToString());
            Log.Info("Right", fret.Right.ToString());
            Log.Info("Top", fret.Top.ToString());
            Log.Info("Bottom", fret.Bottom.ToString());

            return metrics;
        }
开发者ID:sagisprojects,项目名称:Virtual-Guitar-Teacher,代码行数:64,代码来源:NoteRepresentation.cs

示例5: OnCreateView


//.........这里部分代码省略.........

            CropViewMaxPos = new PointF( CropViewMinPos.X + (scaledWidth - CropView.LayoutParameters.Width),
                                         CropViewMinPos.Y + (scaledHeight - CropView.LayoutParameters.Height) );

            view.AddView( CropView );

            // create a mask layer that will block out the parts of the image that will be cropped
            MaskLayer = new Rock.Mobile.PlatformSpecific.Android.Graphics.MaskLayer( (int)ScreenSize.Width, (int)ScreenSize.Height, CropView.LayoutParameters.Width, CropView.LayoutParameters.Height, Rock.Mobile.PlatformSpecific.Android.Core.Context );
            MaskLayer.LayoutParameters = new RelativeLayout.LayoutParams( (int)ScreenSize.Width, (int)ScreenSize.Height );
            MaskLayer.Opacity = 0.00f;
            view.AddView( MaskLayer );

            // Now setup our bottom area with cancel, crop, and text to explain
            RelativeLayout bottomBarLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
            bottomBarLayout.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
            ((RelativeLayout.LayoutParams)bottomBarLayout.LayoutParameters).AddRule( LayoutRules.AlignParentBottom );

            // set the nav subBar color (including opacity)
            Color navColor = Rock.Mobile.UI.Util.GetUIColor( PrivateSubNavToolbarConfig.BackgroundColor );
            navColor.A = (Byte) ( (float) navColor.A * PrivateSubNavToolbarConfig.Opacity );
            bottomBarLayout.SetBackgroundColor( navColor );

            bottomBarLayout.LayoutParameters.Height = 150;
            view.AddView( bottomBarLayout );

            // setup the cancel button (which will undo cropping or take you back to the picture taker)
            CancelButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
            CancelButton.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
            CancelButton.Gravity = GravityFlags.Left;
            ((RelativeLayout.LayoutParams)CancelButton.LayoutParameters).AddRule( LayoutRules.AlignParentLeft );

            // set the crop button's font
            Android.Graphics.Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
            CancelButton.SetTypeface( fontFace, Android.Graphics.TypefaceStyle.Normal );
            CancelButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateImageCropConfig.CropCancelButton_Size );
            CancelButton.Text = PrivateImageCropConfig.CropCancelButton_Text;

            CancelButton.Click += (object sender, EventArgs e) =>
                {
                    // don't allow button presses while animations are going on
                    if( Animating == false )
                    {
                        // if they hit cancel while previewing, go back to editing
                        if( Mode == CropMode.Previewing )
                        {
                            SetMode( CropMode.Editing );
                        }
                        else
                        {
                            // they pressed it while they're in editing mode, so go back to camera mode
                            Activity.OnBackPressed( );
                        }
                    }
                };

            bottomBarLayout.AddView( CancelButton );

            // setup the Confirm button, which will use a font to display its graphic
            ConfirmButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
            ConfirmButton.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
            ConfirmButton.Gravity = GravityFlags.Right;
            ((RelativeLayout.LayoutParams)ConfirmButton.LayoutParameters).AddRule( LayoutRules.AlignParentRight );

            // set the crop button's font
            fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
            ConfirmButton.SetTypeface( fontFace, Android.Graphics.TypefaceStyle.Normal );
            ConfirmButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateImageCropConfig.CropOkButton_Size );
            ConfirmButton.Text = PrivateImageCropConfig.CropOkButton_Text;

            // when clicked, we should crop the image.
            ConfirmButton.Click += (object sender, EventArgs e) =>
                {
                    // don't allow button presses while animations are going on
                    if( Animating == false )
                    {
                        // if they pressed confirm while editing, go to preview
                        if( Mode == CropMode.Editing )
                        {
                            SetMode( CropMode.Previewing );
                        }
                        else
                        {
                            // notify the caller
                            SpringboardParent.ModalFragmentDone( CroppedImage );
                        }
                    }
                };

            bottomBarLayout.AddView( ConfirmButton );

            // start in editing mode (obviously)
            SetMode( CropMode.Editing );

            // start the cropper centered
            MoveCropView( new PointF( (ScreenSize.Width - CropView.LayoutParameters.Width) / 2, (ScreenSize.Height - CropView.LayoutParameters.Height) / 2 ) );

            MaskLayer.Position = new PointF( CropView.GetX( ), CropView.GetY( ) );

            return view;
        }
开发者ID:jhawkzz,项目名称:CCVApp,代码行数:101,代码来源:ImageCropFragment.cs


注:本文中的Android.Views.View.GetY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。