| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入框 |
| | | /// </summary> |
| | | /// <param name="confirmAction">回调函数</param> |
| | | public void InputBox(FrameLayout frameLayout,string tnputEditTxet, Action<string, FrameLayout> confirmAction, bool if_bool = true) |
| | | { |
| | | FrameLayout frame = new FrameLayout() |
| | | { |
| | | BackgroundColor = MusicColor.PopupBackgroundColor, |
| | | }; |
| | | frameLayout.AddChidren(frame); |
| | | FrameLayout whiteView = new FrameLayout() |
| | | { |
| | | //Gravity = Gravity.Center, |
| | | X = Application.GetRealWidth(53), |
| | | Y = Application.GetRealHeight(264), |
| | | Width = Application.GetRealWidth(270), |
| | | Height = Application.GetRealHeight(201), |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), |
| | | }; |
| | | frame.AddChidren(whiteView); |
| | | |
| | | |
| | | Button btnTitle = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(20), |
| | | X = Application.GetRealWidth(35), |
| | | Height = Application.GetRealHeight(22), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = MusicColor.SelectedColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = StringId.shuruyaokongqimingcheng, |
| | | |
| | | }; |
| | | whiteView.AddChidren(btnTitle); |
| | | |
| | | FrameLayout editBjView = new FrameLayout() |
| | | { |
| | | // Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTitle.Bottom + Application.GetRealHeight(16), |
| | | X = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(222), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = MusicColor.ViewColor, |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), |
| | | }; |
| | | whiteView.AddChidren(editBjView); |
| | | |
| | | EditText editText = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(12), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = tnputEditTxet, |
| | | TextColor = MusicColor.TextColor, |
| | | TextSize = TextSize.Text14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | editBjView.AddChidren(editText); |
| | | |
| | | Button clearIconBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(194), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "MusicIcon/clear.png", |
| | | }; |
| | | editBjView.AddChidren(clearIconBtn); |
| | | clearIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | editText.Text = ""; |
| | | }; |
| | | |
| | | |
| | | Button btnTipText = new Button |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = editBjView.Bottom + Application.GetRealHeight(12), |
| | | Width = Application.GetRealWidth(211), |
| | | Height = Application.GetRealHeight(35), |
| | | Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"), |
| | | IsMoreLines = true, |
| | | TextColor = MusicColor.MusicNoTxetColor, |
| | | TextSize = TextSize.Text12, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | whiteView.AddChidren(btnTipText); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | Y = whiteView.Height - Application.GetRealHeight(44 + 1), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = MusicColor.LineColor, |
| | | }; |
| | | whiteView.AddChidren(btnLine); |
| | | |
| | | Button btnCancel = new Button() |
| | | { |
| | | Y = btnLine.Bottom, |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = MusicColor.TextCancelColor, |
| | | TextSize = TextSize.Text16, |
| | | TextID = StringId.cancelMusic, |
| | | Gravity = Gravity.BottomLeft, |
| | | }; |
| | | whiteView.AddChidren(btnCancel); |
| | | btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); |
| | | |
| | | Button btnConfirm = new Button() |
| | | { |
| | | X = btnCancel.Right, |
| | | Y = btnLine.Bottom, |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = MusicColor.WhiteColor, |
| | | IsBold = true, |
| | | TextSize = TextSize.Text16, |
| | | TextID = StringId.confirmMusic, |
| | | BackgroundColor = MusicColor.SelectedColor, |
| | | Gravity = Gravity.BottomRight, |
| | | }; |
| | | whiteView.AddChidren(btnConfirm); |
| | | btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | frame.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(editText.Text.Trim())) |
| | | { |
| | | return; |
| | | } |
| | | confirmAction(editText.Text.Trim(), frame); |
| | | if (if_bool) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |