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


C# Button.SetX方法代码示例

本文整理汇总了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);
        }
开发者ID:ZENG-Yuhao,项目名称:Xamarin-CrossPlatform,代码行数:28,代码来源:GameActivity.cs

示例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 );
        }
开发者ID:jhawkzz,项目名称:CCVApp,代码行数:48,代码来源:NavbarFragment.cs


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