本文整理汇总了C#中Button.SetX方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetX方法的具体用法?C# Button.SetX怎么用?C# Button.SetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.SetX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var mLayout = new FrameLayout(this);
surface = UrhoSurface.CreateSurface(this, typeof(MySample));
//surface.Background.SetAlpha(10);
TextView txtView = new TextView(this);
txtView.SetBackgroundColor(Color.Violet);
txtView.SetWidth(10);
txtView.SetHeight(10);
txtView.Text = "HAHAH";
//txtView.Text = surface.Background.ToString();
Button btn = new Button(this);
btn.SetBackgroundColor(Color.Transparent);
btn.Text = "Button";
btn.SetHeight(100);
btn.SetWidth(100);
btn.SetX(30);
btn.SetY(30);
btn.TextAlignment = TextAlignment.Center;
mLayout.AddView(txtView);
mLayout.AddView(btn);
mLayout.AddView(surface);
SetContentView(mLayout);
}
示例2: CreateSpringboardButton
void CreateSpringboardButton( RelativeLayout relativeLayout )
{
// create the button
SpringboardRevealButton = new Button( Activity );
// clear the background outline
SpringboardRevealButton.Background = null;
// position it vertically centered and a little right indented
SpringboardRevealButton.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)SpringboardRevealButton.LayoutParameters).AddRule( LayoutRules.CenterVertical );
SpringboardRevealButton.SetX( 10 );
// set the font and text
Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
SpringboardRevealButton.SetTypeface( fontFace, TypefaceStyle.Normal );
SpringboardRevealButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivatePrimaryNavBarConfig.RevealButton_Size );
SpringboardRevealButton.Text = PrivatePrimaryNavBarConfig.RevealButton_Text;
// use the completely overcomplicated color states to set the normal vs pressed color state.
int [][] states = new int[][]
{
new int[] { Android.Resource.Attribute.StatePressed },
new int[] { Android.Resource.Attribute.StateEnabled },
new int[] { -Android.Resource.Attribute.StateEnabled },
};
// let the "pressed" version just use a darker version of the normal color
uint mutedColor = Rock.Mobile.Graphics.Util.ScaleRGBAColor( ControlStylingConfig.TextField_PlaceholderTextColor, 2, false );
int [] colors = new int[]
{
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ),
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
};
SpringboardRevealButton.SetTextColor( new Android.Content.Res.ColorStateList( states, colors ) );
// setup the click callback
SpringboardRevealButton.Click += (object sender, System.EventArgs e) =>
{
RevealSpringboard( !SpringboardRevealed );
SpringboardParent.RevealButtonClicked( );
};
relativeLayout.AddView( SpringboardRevealButton );
}