本文整理汇总了C#中Android.Views.View.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# View.GetX方法的具体用法?C# View.GetX怎么用?C# View.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.GetX方法的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 ();
}
示例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;
}
示例3: GetX
public static float GetX(View view)
{
return view.GetX();
}
示例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;
}
示例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;
}