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


C# Button.SetBackgroundColor方法代码示例

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


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

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here

            SetContentView (Resource.Layout.display_layout);

            delete_Btn = FindViewById<Button> (Resource.Id.delete_btn);
            delete_Btn.SetBackgroundColor (Android.Graphics.Color.Red);

            confirm_Btn = FindViewById<Button> (Resource.Id.confirm_btn);
            confirm_Btn.SetBackgroundColor (Android.Graphics.Color.Green);

            imageView = FindViewById <ImageView> (Resource.Id.image);
            var position = Intent.GetStringExtra ("pos");
            var source = Intent.GetStringExtra ("source");

            Android.Net.Uri uri = Android.Net.Uri.Parse (source);
            imageView.SetImageURI (uri);

            confirm_Btn.Click += (object sender, EventArgs e) => {
                Finish ();
            };

            delete_Btn.Click += (object sender, EventArgs e) => {

                //MessageActivity._temp_IMG_List.RemoveAt(int.Parse(position));

                var intent = new Intent();
                intent.PutExtra("delete",position);
                SetResult(Result.Ok,intent);
                Finish ();
            };
        }
开发者ID:WenF,项目名称:SSCA_FlagThis,代码行数:35,代码来源:DisplayPhotoActivity.cs

示例2: 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

示例3: GetSampleContent

		public override View GetSampleContent (Android.Content.Context con)
		{
			
			dlgAlert = new AlertDialog.Builder(con);

			dlgAlert.SetTitle("Results");
			dlgAlert.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) => 
				{
				});
			dlgAlert.SetCancelable(true);

			Title.Add ("Software");
			Title.Add ("Banking");
			Title.Add ("Media");
			Title.Add ("Medical");
			spinners = new Spinner(con);
			spinners.DropDownWidth = 500;
			spinners.SetBackgroundColor(Color.Gray);

			ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
				(con, Android.Resource.Layout.SimpleSpinnerItem, Experience);
			dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinners.Adapter = dataAdapter;

			Country.Add ("UAE");
			Country.Add ("Uruguay");
			Country.Add ("United States");
			Country.Add ("United Kingdom");
			Country.Add ("Ukraine");

			Experience.Add ("1");
			Experience.Add ("2");

			autoComplete1 = new SfAutoComplete(con);
			autoComplete2 = new SfAutoComplete(con);

			text1s = new TextView(con);
			text2s = new TextView(con);
			text3s = new TextView(con);
			text4s = new TextView(con);
			text6s = new TextView(con);

			text11 = new TextView(con);
			text22 = new TextView(con);
			text33 = new TextView(con);
			text44 = new TextView(con);
			text55 = new TextView(con);
			text66 = new TextView(con);
			text77 = new TextView(con);
			text88 = new TextView(con);

			buttons = new Button(con);
			buttons.SetWidth(ActionBar.LayoutParams.MatchParent);
			buttons.SetHeight(40);
			buttons.Text = "Search";
			buttons.SetTextColor(Color.White);
			buttons.SetBackgroundColor(Color.Gray);
			buttons.Click += (object sender, EventArgs e) => {
				GetResult();
				//dlgAlert.SetMessage(count + " Jobs Found");
				dlgAlert.SetMessage (cc + " Jobs Found");
				dlgAlert.Create ().Show ();
			};
			text11.SetHeight(10);
			text22.SetHeight(30);
			text33.SetHeight(10);
			text44.SetHeight(30);
			text55.SetHeight(10);
			text66.SetHeight(30);
			text77.SetHeight(10);
			text88.SetHeight(30);

			text1s.Text = "Job Search";
			text1s.TextSize = 30;
			text1s.Typeface = Typeface.DefaultBold;
			text2s.Text = "Country";
			text2s.TextSize = 16;
			text3s.Text = "Job Field";
			text3s.TextSize = 16;
			text4s.Text = "Experience";
			text4s.TextSize = 16;
			text6s.SetHeight(40);

			ArrayAdapter<String> adapters = new ArrayAdapter<String>(con,
				Android.Resource.Layout.SimpleListItem1, new Countrylist().Country);
			autoComplete1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
			autoComplete1.SetAutoCompleteSource(adapters);
			autoComplete1.SuggestionMode = SuggestionMode.StartsWith;
			autoComplete1.MaximumDropDownHeight = 200;
			autoComplete1.Watermark = "Enter a country name";

			ArrayAdapter<String> adapters1 = new ArrayAdapter<String>(con,
				Android.Resource.Layout.SimpleListItem1, Title);
			autoComplete2.SetAutoCompleteSource(adapters1);
			autoComplete2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
			autoComplete2.SuggestionMode = SuggestionMode.Contains;
			autoComplete2.MaximumDropDownHeight = 200;
			autoComplete2.Watermark = "Starts with ’S’, ‘M’ or ‘B’";

			ArrayAdapter<String> adapters2 = new ArrayAdapter<String>(con,
//.........这里部分代码省略.........
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:101,代码来源:AutoComplete.cs

示例4: GenerateButton

        private Button GenerateButton(MenuItem item)
        {
            Button btn = new Button (_context);
            btn.Text = item.Text;

            var param = new TableLayout.LayoutParams (0, LayoutParams.WrapContent, 1f);
            if (margin >= 0) {
                marginBottom = marginLeft = marginTop = marginRight = margin;
            }
            param.BottomMargin = MarginBottom;
            param.LeftMargin = MarginLeft;
            param.TopMargin = MarginTop;
            param.RightMargin = MarginRight;

            btn.LayoutParameters = param;

            if (item.IconId != 0) {
                btn.SetCompoundDrawablesWithIntrinsicBounds (null,
                    Resources.GetDrawable (item.IconId),
                    null, null);
            }
            btn.SetTypeface (tabTypeface, typefaceStyle);
            btn.SetTextColor (TextColor);
            btn.TextSize = TextSize;
            btn.SetBackgroundColor (ItemBgColor);
            btn.SetBackgroundResource (ItemBg);
            if (padding != 0) {
                paddingLeft = paddingTop = paddingRight = paddingBottom = padding;
            }
            btn.SetPadding (paddingLeft, paddingTop, paddingRight, paddingBottom);
            btn.Click += (o, e) => {
                if (ItemClicked != null) {
                    ItemClicked (this, item.ItemId);
                }
            };
            return btn;
        }
开发者ID:Nininea,项目名称:ForwardNavigationMenu,代码行数:37,代码来源:ForwardNavigationMenu.cs

示例5: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.account, container, false);

            TextView playerinfolabel=(TextView)rootview.FindViewById (Resource.Id.account_playerinfo_textview);
            playerinfolabel.Text=AccountScreenData.PlayerInfoLabelText;

            TextView namelabel=(TextView)rootview.FindViewById (Resource.Id.account_name_label);
            namelabel.Text = AccountScreenData.NameLabelText;
            TextView addresslabel=(TextView)rootview.FindViewById (Resource.Id.account_address_label);
            addresslabel.Text = AccountScreenData.AddressLabelLabelText;
            TextView mobilelabel=(TextView)rootview.FindViewById (Resource.Id.account_mobile_label);
            mobilelabel.Text = AccountScreenData.MobileLabelText;
            TextView emaillabel=(TextView)rootview.FindViewById (Resource.Id.account_email_label);
            emaillabel.Text = AccountScreenData.EmailLabelText;
            TextView doblabel=(TextView)rootview.FindViewById (Resource.Id.account_dob_label);
            doblabel.Text = AccountScreenData.DOBLabelText;

            TextView spreadwordlabel=(TextView)rootview.FindViewById (Resource.Id.account_spreadword_textview);
            spreadwordlabel.Text = AccountScreenData.SpreadTheWordLabelText;
            TextView spreadworddetail=(TextView)rootview.FindViewById (Resource.Id.account_spreadworddetail_textview);
            spreadworddetail.Text = AccountScreenData.SpreadTheWordMessageText;
            spreadworddetail.Id = TapUtil.generateViewId ();

            LinearLayout spreadlinearlayout=(LinearLayout)rootview.FindViewById (Resource.Id.account_spreadwordpanel_linearlayout);

            //			LikeView likeview = new LikeView (nn_activity);
            //			var likeviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            //			likeviewparam.AddRule (LayoutRules.Below, spreadworddetail.Id);
            //			likeview.LayoutParameters = likeviewparam;
            //			likeview.SetLikeViewStyle (LikeView.Style.Button);
            //			likeview.SetFragment (this);
            //			likeview.AlwaysDrawnWithCacheEnabled = true;
            //			likeview.SetObjectIdAndType( "https://www.facebook.com/tap5050",LikeView.ObjectType.Page);

            Button likeview = new Button (nn_activity);
            var likeviewparam=new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
            likeviewparam.Gravity = GravityFlags.CenterHorizontal;
            likeview.LayoutParameters = likeviewparam;
            likeview.SetBackgroundColor (Resources.GetColor(Resource.Color.iosblue));
            likeview.SetTextColor (Resources.GetColor(Resource.Color.white));
            likeview.Typeface = global::Android.Graphics.Typeface.DefaultBold;
            likeview.Text=AccountScreenData.facebookLikeBtnTitle;
            likeview.Click -= OnClickLike;
            likeview.Click += OnClickLike;

            spreadlinearlayout.AddView (likeview);

            nametextview=(TextView)rootview.FindViewById (Resource.Id.account_name_textview);
            addresstextview=(TextView)rootview.FindViewById (Resource.Id.account_address_textview);
            mobiletextview=(TextView)rootview.FindViewById (Resource.Id.account_mobile_textview);
            emailtextview=(TextView)rootview.FindViewById (Resource.Id.account_email_textview);
            dobtextview=(TextView)rootview.FindViewById (Resource.Id.account_dob_textview);

            resetsocialbut = (Button)rootview.FindViewById (Resource.Id.account_resetsocial_button);
            resetsocialbut.Text = AccountScreenData.LogoutSocialBtnTitle;
            resetsocialbut.Click+= (object sender, EventArgs e) => {
                nn_activity.ShowCustomAlterDialogFragment(AccountScreenData.AlertScreenLogoutSocialTitle,AccountScreenData.AlertScreenLogoutSocialMessage,GlobalScreenData.DefaultPositive,GlobalScreenData.DefaultNegative,"WarnRestSocial");
            };

            signoutbut = (Button)rootview.FindViewById (Resource.Id.account_signout_button);
            signoutbut.Text = AccountScreenData.LogoutBtnTitle;
            signoutbut.Click += (object sender, EventArgs e) => {
                nn_activity.ShowCustomNeutralAlterDialogFragment(AccountScreenData.AlertScreenLogoutTitle,AccountScreenData.AlertScreenLogoutMessage,AccountScreenData.AlertScreenLogoutFirstBtnTitle,GlobalScreenData.DefaultNegative,AccountScreenData.AlertScreenLogoutSecondBtnTitle,"WarnSignOut");
            };

            resetpassword = (Button)rootview.FindViewById (Resource.Id.account_resetpassword_button);
            resetpassword.Text = AccountScreenData.ResetPasswordBtnTitle;
            resetpassword.Click+= (object sender, EventArgs e) => {
                RestPassword();
            };

            return rootview;
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:74,代码来源:AccountRootFragment.cs

示例6: SetButtonState

        private void SetButtonState(Button button, bool isEnabled)
        {
            button.SetBackgroundColor(isEnabled
                ? this.Resources.GetColor(Resource.Color.mediumgray)
                : this.Resources.GetColor(Resource.Color.darkgray));

            button.Enabled = isEnabled;
        }
开发者ID:America4Animals,项目名称:AFA,代码行数:8,代码来源:CrueltySpotActivity.cs


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