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


C# ToggleButton.SetBackgroundColor方法代码示例

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


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

示例1: InitializeComponents

 private void InitializeComponents()
 {
     this.ActionBar.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.Black));
     this.ActionBar.SetTitle (Resource.String.settings);
     notificationToggle = FindViewById<ToggleButton> (Resource.Id.NotificationToggleButton);
     notificationToggle.SetBackgroundColor (Android.Graphics.Color.Rgb (1, 187, 225));
     notificationToggle.Checked = GetNotificationTogglePref ();
     soundCheckBox = FindViewById<CheckBox> (Resource.Id.SoundCheckBox);
     soundCheckBox.Checked = GetNotificationSoundPref ();
     vibrationCheckBox = FindViewById<CheckBox> (Resource.Id.VibrationCheckBox);
     vibrationCheckBox.Checked = GetNotificationVibrationPref ();
     dongleListLayout = FindViewById<LinearLayout> (Resource.Id.dongleListLayout);
     dongleButtonLayout = FindViewById<LinearLayout> (Resource.Id.dongleSubButtonLayout);
 }
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:14,代码来源:SettingsActivity.cs

示例2: LoadDongleList

 //TODO: [GROUP32] Cleanup Impelmentation
 private void LoadDongleList()
 {
     MyLogger.Information (this.LocalClassName, "Dongle List: loading...");
     int i = 0;
     ToggleButton button;
     TextView item;
     LoadMojioDevices ();
     foreach (Device moj in UserDevices) {
         item = new TextView (this);
         item.SetTextColor (Android.Graphics.Color.Rgb (1, 187, 225));
         item.SetTextSize (Android.Util.ComplexUnitType.Px, 35);
         item.Id = i;
         item.Text = string.Format ("   {0} \n", moj.Name);
         MyLogger.Information (this.LocalClassName, string.Format ("Dongle List: {0} loaded.", moj.Name));
         RelativeLayout.LayoutParams parameters =
             new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent,
                 RelativeLayout.LayoutParams.WrapContent);
         parameters.AddRule (LayoutRules.AlignParentBottom);
         parameters.AddRule (LayoutRules.CenterVertical);
         if (i != 0)
             parameters.AddRule (LayoutRules.Above, i - 1);
         item.LayoutParameters = parameters;
         button = new ToggleButton (this);
         button.SetBackgroundColor (Android.Graphics.Color.Rgb (1, 187, 225));
         button.Id = i;
         button.LayoutParameters = parameters;
         button.Click += (o, args) => {
             //TODO: [GROUP 32] When we add more event types for our app change this line so that
             // depending on the button clicked, corresponding event type is sent to the handler
             OnDeviceSubscriptionToggleClicked (moj, EventType.TowStart, (o as ToggleButton).Checked);
         };
         button.Checked = CurrentUserPreference.GetSubscriptionStatus (EventType.TowStart, moj);
         LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams (
                                                      LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
         layoutParams.SetMargins (5, 0, 5, 15);
         layoutParams.Height = 65;
         dongleListLayout.AddView (item);
         dongleButtonLayout.AddView (button, layoutParams);
         i++;
     }
     MyLogger.Information (this.LocalClassName, string.Format ("{0} dongle(s) loaded.", i));
 }
开发者ID:rockyhe,项目名称:MojioTowingAlert,代码行数:43,代码来源:SettingsActivity.cs


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