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


C# Spinner.SetBackgroundColor方法代码示例

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


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

示例1: OnCreate

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

            // Create your application here
            // Set the layout
            SetContentView(Resource.Layout.ActivitySettings);
            _OfflineSwitch = FindViewById<Switch> (Resource.Id.switch1);
            _btnUploadData = FindViewById<Button>(Resource.Id.BtnUploadData);
            _btnClear = FindViewById<Button>(Resource.Id.BtnClear);
            _btnUrlSave = FindViewById<Button>(Resource.Id.BtnUrlSave);
            _btnChangePassword = FindViewById<Button>(Resource.Id.BtnChangePassword);
            _btnLog = FindViewById<Button>(Resource.Id.BtnLog);
            _edUrl = FindViewById<EditText>(Resource.Id.edUrl);
            _tvAndroidID = FindViewById<TextView>(Resource.Id.tvAndroidID);

            // Spinner for the main color of the app
            // Set the main colors
            _colors = new List<int>();
            _colors.Add(Android.Resource.Color.HoloOrangeDark);
            _colors.Add(Android.Resource.Color.HoloBlueDark);
            _colors.Add(Android.Resource.Color.DarkerGray);
            _colors.Add(Android.Resource.Color.HoloGreenDark);
            _colors.Add(Android.Resource.Color.HoloRedDark);

            // Initialze the color spinner
            _spinnerMainColor = FindViewById<Spinner>(Resource.Id.spinnerMainColor);
            MainColorViewAdapter _adapter = new MainColorViewAdapter (this,_colors);
            _spinnerMainColor.SetBackgroundColor( Resources.GetColor(DataAccessLayer.Utilities.MainColor));
            _spinnerMainColor.SetBackgroundResource(DataAccessLayer.Utilities.MainColor);
            _spinnerMainColor.Adapter = _adapter;

            // Initialize the LoginSaveOption Spinner
            _spinnerLoginSaveOption = FindViewById<Spinner>(Resource.Id.spinnerLoginSaveOption);
            LoginSaveOptionViewAdapter _LSO_adapter = new LoginSaveOptionViewAdapter(this);



            _spinnerLoginSaveOption.Adapter = _LSO_adapter;

            // Set the right selected item for the spinnerMainColor
            switch (DataAccessLayer.Utilities.MainColor)
            {
                case Android.Resource.Color.HoloOrangeDark:
                    _spinnerMainColor.SetSelection(0);
                    break;
                case Android.Resource.Color.HoloBlueDark:
                    _spinnerMainColor.SetSelection(1);
                    break;
                case Android.Resource.Color.DarkerGray:
                    _spinnerMainColor.SetSelection(2);
                    break;
                case Android.Resource.Color.HoloGreenDark:
                    _spinnerMainColor.SetSelection(3);
                    break;
                case Android.Resource.Color.HoloRedDark:
                    _spinnerMainColor.SetSelection(4);
                    break;
                default:
                    _spinnerMainColor.SetSelection(0);
                    break;
            }

            // Set the right selected item for the spinnerLoginSaveOption
            _spinnerLoginSaveOption.SetSelection(Convert.ToInt32( BusinessLayer.User.GetLoginSaveOption()));

            // Set the status of the button 
            if (UI.MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) 
                _OfflineSwitch.Checked = false;
            else
                _OfflineSwitch.Checked = true;

            // Enable or disable the Button to sync offline data
            offlineTasks =  BusinessLayer.Task.HasNewOfflineTasks();
            if (offlineTasks != 0 &&MainActivity.User.NetworkStatus  != DataAccessLayer.NetworkState.Disconnected)
                _btnUploadData.Enabled = true;
            else
                _btnUploadData.Enabled = false;

            // If the app is offline, the switch control must be disabled
            if (UI.MainActivity._networkstate == DataAccessLayer.NetworkState.Disconnected)
                _OfflineSwitch.Enabled = false;
            else
                _OfflineSwitch.Enabled = true;

            // Set the current URL
            _edUrl.Text = DataAccessLayer.Utilities.ServerIP;

            // set the android ID
            _tvAndroidID.Text = Android.Provider.Settings.Secure.GetString(this.ContentResolver,
                Android.Provider.Settings.Secure.AndroidId); 
            
            // Set the event handler of the controls 
            SetControlEvents(true);

        }
开发者ID:MbProg,项目名称:TestApolloAndroid,代码行数:96,代码来源:SettingsActivity.cs

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

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

		public override View GetSampleContent (Context con)
		{
			spinner = new Spinner(con);
			spinner.SetMinimumHeight(60);
			spinner.DropDownWidth = 500;
			spinner.SetBackgroundColor(Color.Gray);
		
			List<String> list = new List<String>();
			list.Add("Ball");
			list.Add("Battery");
			list.Add("DoubleCircle");
			list.Add("ECG");
			list.Add("Globe");
			list.Add("HorizontalPulsingBox");
			list.Add("MovieTimer");
			list.Add("Print");
			list.Add("Rectangle");
			list.Add("RollingBall");
			list.Add("SingleCircle");
			list.Add("SlicedCircle");
			list.Add("ZoomingTarget");

			ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
				(con, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinner.Adapter = dataAdapter;
			spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);

			TextView textView = new TextView(con);
			textView.TextSize = 20;
			textView.Text = "Animation Type";
			TextView textView1 = new TextView(con);
			textView1.TextSize = 10;
			textView.SetTextColor(Color.Black);

			TextView textView2 = new TextView(con);
			textView2.TextSize = 10;
			textView2.SetTextColor(Color.Black);

			LinearLayout linearLayout = new LinearLayout(con);
			linearLayout.SetPadding(20, 20, 20, 30);
			linearLayout.SetBackgroundColor(Color.Rgb(236,235,242));
			linearLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,
				LinearLayout.LayoutParams.WrapContent);
			linearLayout.Orientation = Orientation.Vertical;
			linearLayout.AddView(textView);
			linearLayout.AddView(textView2);
			linearLayout.AddView(spinner);
			linearLayout.AddView(textView1);

			sfBusyIndicator = new SfBusyIndicator(con);
			sfBusyIndicator.IsBusy = true;
			sfBusyIndicator.TextColor = Color.Rgb(62,101,254);
			sfBusyIndicator.AnimationType = AnimationTypes.DoubleCircle;
			sfBusyIndicator.ViewBoxWidth = 200;
			sfBusyIndicator.ViewBoxHeight = 200;
			sfBusyIndicator.TextSize = 60;
			sfBusyIndicator.Title = "";
			sfBusyIndicator.SetBackgroundColor(Color.Rgb(255,255,255));
			linearLayout.AddView(sfBusyIndicator);
			// Set our view from the "main" layout resource
			return linearLayout;
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:63,代码来源:BusyIndicator.cs


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