本文整理汇总了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);
}
示例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));
}