我有一个问题。我正在使用ChiralCode.ColorPickerLib.ColorPicker nuget包来显示颜色选择器。但是现在我要删除亮度滑块,因为我想用此颜色选择器控制我的LED,而灰色是不可能的颜色。我该怎么办?
这是我用于颜色选择器的代码:
public class ColorPicker : Android.Support.V4.App.DialogFragment
{
Button btnSelectColor;
ChiralCode.ColorPickerLib.ColorPicker ColorPickerDialog;
public static string SelectedColor;
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
}
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
View view = inflater.Inflate(Resource.Layout.main_color_picker, container, false);
ColorPickerDialog = view.FindViewById<ChiralCode.ColorPickerLib.ColorPicker>(Resource.Id.colorPicker);
btnSelectColor = view.FindViewById<Button>(Resource.Id.btnSelectColor);
btnSelectColor.Click += btnSelectColor_Click;
return view;
}
public override void OnActivityCreated(Bundle savedInstanceState)
{
Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
base.OnActivityCreated(savedInstanceState);
Dialog.Window.Attributes.WindowAnimations = Resource.Style.dialog_animation;
}
public void btnSelectColor_Click(object sender, EventArgs e)
{
int RawInt = ColorPickerDialog.GetColor();
int A = (RawInt >> 24) & 0xff; // or color >>> 24
int R = (RawInt >> 16) & 0xff;
int G = (RawInt >> 8) & 0xff;
int B = (RawInt) & 0xff;
SelectedColor = "#" + R.ToString("X2") + G.ToString("X2") + B.ToString("X2");
Project_Settings.skiaView.Invalidate();
(Activity as MainActivity)?.HideDialog(this);
}
}