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


C# EditText.SetBackgroundColor方法代码示例

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


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

示例1: OnCreate

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

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            cs = new ClientSocket(this);

            _smsSentBroadcastReceiver = new SMSSentReceiver();
            _smsDeliveredBroadcastReceiver = new SMSDeliveredReceiver();
            _smsSentBroadcastReceiver.sentErrorReSendEvent += reSend;
            _smsDeliveredBroadcastReceiver.deliverErrorReSendEvent += reSend;

            ipText = FindViewById<EditText>(Resource.Id.IPText);
            connectButton = FindViewById<ImageButton>(Resource.Id.connectImageButton);

            connectButton.Click += delegate
            {
                if (ipText.Text != "") {
                    cs.Connect(ipText.Text);
                }
                else {
                    ipText.SetBackgroundColor(Android.Graphics.Color.Red);
                    ipText.Error = "Enter IP address!";
                }
            };
        }
开发者ID:JrRjChan,项目名称:BotHelper,代码行数:28,代码来源:MainActivity.cs

示例2: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);

            var view = inflater.Inflate (Resource.Layout.QuoteLayout, container, false);

            quoteLocation = view.FindViewById<EditText> (Resource.Id.quoteLocation);
            quoteModel = view.FindViewById<EditText> (Resource.Id.quoteModel);
            quotePrice = view.FindViewById<EditText> (Resource.Id.quotePrice);
            quotePosition = view.FindViewById<EditText> (Resource.Id.quotePosition);
            quoteButton = view.FindViewById<Button> (Resource.Id.quoteButton);

            quoteLocation.Text = location;
            quoteModel.Text = model;

            quotePrice.RequestFocus ();

            quoteButton.Click += delegate {

                double price;
                bool isDouble = Double.TryParse(quotePrice.Text, out price);
                if(isDouble) {
                    if (price > minPrice) {
                        if (price < minPrice * 1.6) {

                            position = quotePosition.Text;

                            if (position.Length < 15) {
                                Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, position); });
                                thread.Start();
                            }
                            else {
                                Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, ""); });
                                thread.Start();
                            }
                        }
                        quotePrice.SetBackgroundColor(Android.Graphics.Color.Lime);

                        Toast.MakeText(Application.Context, "成功報價!更新中...", ToastLength.Short).Show();

                        var activity = (MainActivity)Activity;

                        Thread thread2 = new Thread(() => { activity.FragmentManager.PopBackStack(); Thread.Sleep(1000); activity.updateGUI(Database.select(location));
                            activity.RunOnUiThread(() => {
                                Toast.MakeText(Application.Context, "更新成功!", ToastLength.Short).Show();
                            });
                        });
                        thread2.Start();

                    }
                    else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "有幾多我同你買幾多!"; }
                }
                else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "Enter number!"; }

            };

            return view;
        }
开发者ID:JrRjChan,项目名称:FirePhone,代码行数:58,代码来源:QuoteFragment.cs

示例3: InitializeVariables

 private void InitializeVariables()
 {
     this.ActionBar.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.Black));
     this.ActionBar.SetTitle (Resource.String.application);
     loginButton = FindViewById<Button> (Resource.Id.logInButton);
     username = FindViewById<EditText> (Resource.Id.usernameEntry);
     password = FindViewById<EditText> (Resource.Id.passwordEntry);
     username.SetBackgroundColor (Android.Graphics.Color.Orange);
     username.SetTextColor (Android.Graphics.Color.White);
     username.SetHintTextColor (Android.Graphics.Color.White);
     password.SetBackgroundColor (Android.Graphics.Color.Orange);
     password.SetTextColor (Android.Graphics.Color.White);
     password.SetHintTextColor (Android.Graphics.Color.White);
 }
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:14,代码来源:LoginActivity.cs

示例4: updateTextAttributes

        private void updateTextAttributes(EditText title, EditText content)
        {
            float baseSize = Float.parseFloat(Preferences.GetString(Preferences.Key.BASE_TEXT_SIZE));
            content.SetTextSize(baseSize);
            title.SetTextSize(baseSize*1.3f);

            title.SetTextColor(Color.Blue);
            title.PaintFlags = title.PaintFlags | PaintFlags.UnderlineText;
            title.SetBackgroundColor(0xffffffff);

            content.SetBackgroundColor(0xffffffff);
            content.SetTextColor(Color.DarkGray);
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:13,代码来源:CompareNotes.cs

示例5: OnCreate

        private Spinner sp_subcomLocal; //开卡店

        #endregion Fields

        #region Methods

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.OutOne);

            IntentName = Intent.GetStringExtra("cardno");//卡号
            #region 初始化控件
            ibtn_cancel = FindViewById<ImageButton>(Resource.Id.OutOne_cancel);
            btn_save = FindViewById<Button>(Resource.Id.OutOne_save);
            sp_subcom = FindViewById<Spinner>(Resource.Id.OutOne_SubCom);//选择分店
            et_search = FindViewById<EditText>(Resource.Id.OutOne_Search);//搜索
            et_cusname = FindViewById<EditText>(Resource.Id.OutOne_CusName);//姓名
            sp_sex = FindViewById<Spinner>(Resource.Id.OutOne_Sex);//性别
            sp_subcomLocal = FindViewById<Spinner>(Resource.Id.OutOne_CusTypeLocal);//开卡店
            et_balance = FindViewById<EditText>(Resource.Id.OutOne_Balance);//充值余额
            sp_custype = FindViewById<Spinner>(Resource.Id.OutOne_CusType);//会员级别
            et_laststore = FindViewById<EditText>(Resource.Id.OutOne_Lastdate);//最后充值
            et_integral = FindViewById<EditText>(Resource.Id.OutOne_Integral);//现有积分
            et_discount = FindViewById<EditText>(Resource.Id.OutOne_Discount);//服务折扣
            et_memcard = FindViewById<EditText>(Resource.Id.OutOne_MemCard);//会员卡扣款
            et_customercard = FindViewById<EditText>(Resource.Id.OutOne_CustomerCard);//会员卡号
            et_ysmoney = FindViewById<EditText>(Resource.Id.OutOne_YsMoney);//应收金额
            et_ticketmoneybefore = FindViewById<EditText>(Resource.Id.OutOne_TicketMoneyBefore);//抵扣金额
            et_factmoney = FindViewById<EditText>(Resource.Id.OutOne_FactMoney);//实际应收
            et_carsh = FindViewById<EditText>(Resource.Id.OutOne_Crash);//补现金
            et_selfno = FindViewById<EditText>(Resource.Id.OutOne_Selfno);//手工单号
            et_memo = FindViewById<EditText>(Resource.Id.OutOne_Momo);//备注
            btn_Clean = FindViewById<Button>(Resource.Id.OutOne_Clean);//清除信息
            #endregion

            #region 指定不可编辑项
            et_cusname.Enabled = false;
            et_cusname.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_sex.Enabled = false;
            sp_sex.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_subcomLocal.Enabled = false;
            sp_subcomLocal.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_balance.Enabled = false;
            et_balance.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_custype.Enabled = false;
            sp_custype.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_laststore.Enabled = false;
            et_laststore.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_integral.Enabled = false;
            et_integral.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_memcard.Enabled = false;
            et_memcard.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_customercard.Enabled = false;
            et_customercard.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            #endregion

            et_cusname.Text = "散客";

            #region Spinner控件赋值
            //性别
            Java.Lang.Object[] sex = { "请选择", "先生", "女士" };
            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sex);
            sp_sex.Adapter = adapter;
            sp_sex.SetSelection(2, true);
            //所属分店
            string[] subcom = SysVisitor.GetArryList("select subno,comname from subcom");
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, subcom);
            sp_subcom.Adapter = adapter;
            //开卡店sp_subcomLocal
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, subcom);
            sp_subcomLocal.Adapter = adapter;
            //会员级别
            string[] custype = SysVisitor.GetArryList("select cardlevel, carcname from cardtype");
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, custype);
            sp_custype.Adapter = adapter;
            #endregion
            if (!string.IsNullOrEmpty(IntentName))
            {
                Onbind(IntentName);
            }
            et_search.FocusChange += delegate
            {
                if (!et_search.HasFocus)
                {
                    string ls_search = et_search.Text.Trim();
                    if (!string.IsNullOrEmpty(ls_search))
                    {
                        Onbind(ls_search);
                    }

                }
            };
            //应收金额
            et_ysmoney.FocusChange += delegate
            {
                if (!et_ysmoney.HasFocus)
                {
                    if (et_ysmoney.Text.Trim() != "")
//.........这里部分代码省略.........
开发者ID:eatage,项目名称:GyAppMf,代码行数:101,代码来源:OutOne.cs

示例6: Init

        private void Init()
        {
            base.RemoveAllViews();

            hintTextView = new EditText(Context);
            textTextView = new NoCursorMovingEditText(Context, BackKeyPressed);

            linearLayout = new LinearLayout(Context);
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight());

            textLayout = new RelativeLayout(Context);
            textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1);
            textLayout.SetGravity(GravityFlags.Center);

            linearLayout.AddView(textLayout);

            textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
            hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText);

            LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent,
                LinearLayout.LayoutParams.WrapContent);
            lp.AddRule(LayoutRules.CenterVertical);

            hintTextView.LayoutParameters = lp;
            textTextView.LayoutParameters = lp;
            hintTextView.Enabled = false;
            hintTextView.Focusable = false;

            textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
            hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;

            hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            int horizontalPadding =
                Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding);
            hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0);
            textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0);

            textErrorView = new EditText(Context);
            RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent,
                LayoutParams.WrapContent);
            errorLP.AddRule(LayoutRules.CenterVertical);

            int margin = UiUtils.ToPixels(Context, 2);
            errorLP.SetMargins(margin, 0, margin, 0);

            textErrorView.LayoutParameters = errorLP;
            textErrorView.Enabled = false;
            textErrorView.Focusable = false;
            textErrorView.Visibility = ViewStates.Gone;
            textErrorView.SetBackgroundColor(Color.Red);
            int errorVerticalPadding =
                Context.Resources.GetDimensionPixelOffset(
                    Resource.Dimension.backgroundhinttextview_error_vertical_padding);
            textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding);
            textErrorView.Text = errorText;
            textErrorView.SetSingleLine(true);
            textErrorView.Gravity = GravityFlags.Center;
            textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText);

            //set courier font
            Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
            //hintTextView.Typeface = type;
            hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            //textTextView.Typeface = type;
            textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            textErrorView.Typeface = type;


            textLayout.AddView(hintTextView);
            textLayout.AddView(textTextView);

            AddView(linearLayout);

            IEnumerable<char> previousCharSequence;
            EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) =>
                                                                    {
                                                                        previousCharSequence = args.Text;
                                                                    };

            EventHandler<TextChangedEventArgs> textChanged = (sender, args) =>
                                                            {
                                                                beforeTextSize = args.BeforeCount;
                                                            };

            EventHandler<AfterTextChangedEventArgs> afterTextChanged = null;

            
            Action<string> updateTextView = newText =>
            {
                textTextView.TextChanged -= textChanged;
                textTextView.BeforeTextChanged -= beforeTextChanged;
                textTextView.AfterTextChanged -= afterTextChanged;

                textTextView.Text = newText;

                textTextView.TextChanged += textChanged;
                textTextView.BeforeTextChanged += beforeTextChanged;
                textTextView.AfterTextChanged += afterTextChanged;
            };
//.........这里部分代码省略.........
开发者ID:TheJaniceTong,项目名称:Judo-Xamarin,代码行数:101,代码来源:BackgroundHintTextView.cs

示例7: AddFixedText

        public void AddFixedText(string text)
        {
            EditText fixedText = new EditText(Context);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            layoutParams.Gravity = GravityFlags.CenterVertical;
            fixedText.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
            fixedText.LayoutParameters = layoutParams;
            fixedText.Enabled = false;
            fixedText.Focusable = false;
            fixedText.Text = text;
            fixedText.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            fixedText.SetPadding(0,0,0,0);
            Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
            fixedText.Typeface = type;

            if (linearLayout.ChildCount > 1)
            {
                linearLayout.RemoveViewAt(0);
            }
            linearLayout.AddView(fixedText, 0);
        }
开发者ID:TheJaniceTong,项目名称:Judo-Xamarin,代码行数:21,代码来源:BackgroundHintTextView.cs

示例8: BuildUI

		void BuildUI (Bundle savedInstanceState)
		{
			var hMargin = 20;

			RequestWindowFeature (WindowFeatures.NoTitle);

			Title = state.Service.ShareTitle;

			layout = new LinearLayout (this) {
				Orientation = Orientation.Vertical,
			};
			layout.SetBackgroundColor (Color.White);
			SetContentView (layout);

			//
			// Toolbar
			//
			toolbar = new ToolbarView (this, Title);
			toolbar.IsProgressing = state.IsSending;
			toolbar.Clicked += (sender, args) => StartSending();
			layout.AddView (toolbar);

			//
			// Scroll content
			//
			var scroller = new ScrollView (this) {
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) {
				},
			};
			var scrollContent = new LinearLayout (this) {
				Orientation = Orientation.Vertical,
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) {
				},
			};
			scroller.ScrollbarFadingEnabled = true;
			scroller.AddView (scrollContent);
			layout.AddView (scroller);

			//
			// Account
			//
			var acctLabel = new TextView (this) {
				Text = "From",
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) {
					RightMargin = 12,
				},
			};
			acctLabel.SetTextColor (Color.DarkGray);
			acctLabel.SetTextSize (ComplexUnitType.Sp, LabelTextSize);

			acctPicker = new TextView (this) {
				Typeface = Typeface.DefaultFromStyle (TypefaceStyle.Bold),
				Clickable = true,
			};
			acctPicker.SetTextColor (Color.Black);
			acctPicker.SetTextSize (ComplexUnitType.Sp, LabelTextSize);
			acctPicker.Click += PickAccount;
			UpdateAccountUI ();

			var acctLayout = new LinearLayout (this) {
				Orientation = Orientation.Horizontal,
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) {
					TopMargin = 24,
					LeftMargin = hMargin,
					RightMargin = hMargin,
				},
			};
			acctLayout.SetGravity (GravityFlags.Left);
			acctLayout.AddView (acctLabel);
			acctLayout.AddView (acctPicker);

			scrollContent.AddView (acctLayout);

			//
			// Attachments
			//
			var attachLayout = new LinearLayout (this) {
				Orientation = Orientation.Vertical,
				Visibility = state.Item.HasAttachments ? ViewStates.Visible : ViewStates.Gone,
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) {
					TopMargin = 30,
					LeftMargin = hMargin,
					RightMargin = hMargin,
				},
			};

			foreach (var x in state.Item.Links) {
				attachLayout.AddView (new AttachmentView (this, x.AbsoluteUri));
			}
			foreach (var x in state.Item.Images) {
				attachLayout.AddView (new AttachmentView (this, x.Filename, x.Length));
			}
			foreach (var x in state.Item.Files) {
				attachLayout.AddView (new AttachmentView (this, x.Filename, x.Length));
			}

			scrollContent.AddView (attachLayout);

			//
			// Composer
//.........这里部分代码省略.........
开发者ID:johnbeans,项目名称:Xamarin.Social,代码行数:101,代码来源:ShareActivity.cs


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