| | |
| | | public NumberFrameLayout() |
| | | { |
| | | } |
| | | |
| | | private uint UpBackgroundColor = MusicColor.WhiteColor; |
| | | private uint DownBackgroundColor = 0xff454635; |
| | | private Action<Button> action = null; |
| | | public FrameLayout layout = new FrameLayout |
| | | { |
| | | |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | IsBold = true, |
| | | }; |
| | | |
| | | |
| | | |
| | | Button btn4 = new Button |
| | | { |
| | | Width = Application.GetRealWidth(78), |
| | |
| | | IsBold = true, |
| | | }; |
| | | |
| | | ButtonFramLayout pdjiaFramLayout = new ButtonFramLayout(); |
| | | Button btn_jia = new Button |
| | | { |
| | | Width = Application.GetRealWidth(78), |
| | | Height = Application.GetRealHeight(84), |
| | | TextID = StringId.pindaojia, |
| | | TextSize = TextSize.Text20, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsBold = true, |
| | | |
| | | ButtonFramLayout pdjianFramLayout = new ButtonFramLayout(); |
| | | |
| | | }; |
| | | |
| | | Button btn_jian = new Button |
| | | { |
| | | Width = Application.GetRealWidth(78), |
| | | Height = Application.GetRealHeight(84), |
| | | TextID = StringId.pindaojian, |
| | | TextSize = TextSize.Text20, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsBold = true, |
| | | |
| | | |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 添加布局 |
| | |
| | | layout.AddChidren(btn9); |
| | | layout.AddChidren(btn0); |
| | | layout.AddChidren(btn); |
| | | layout.AddChidren(pdjiaFramLayout); |
| | | layout.AddChidren(pdjianFramLayout); |
| | | layout.AddChidren(btn_jia); |
| | | layout.AddChidren(btn_jian); |
| | | |
| | | btn1.Y = Application.GetRealHeight(16); |
| | | btn1.X = Application.GetRealWidth(16); |
| | |
| | | btn2.X = btn1.Right; |
| | | btn3.Y = Application.GetRealHeight(16); |
| | | btn3.X = btn2.Right; |
| | | pdjiaFramLayout.AddImageView(); |
| | | pdjiaFramLayout.AddNameView(); |
| | | pdjiaFramLayout.Y = Application.GetRealHeight(16); |
| | | pdjiaFramLayout.GetImageButton().Height = Application.GetRealHeight(32); |
| | | pdjiaFramLayout.GetImageButton().Width = Application.GetRealWidth(32); |
| | | pdjiaFramLayout.GetImageButton().UnSelectedImagePath = "AksIcon/pindao1.png"; |
| | | pdjiaFramLayout.GetNameButton().TextID = StringId.pindaojia; |
| | | pdjiaFramLayout.X = btn3.Right; |
| | | btn_jia.Y = Application.GetRealHeight(16); |
| | | btn_jia.X = btn3.Right; |
| | | |
| | | btn4.Y = btn1.Bottom; |
| | | btn4.X = Application.GetRealWidth(16); |
| | |
| | | btn5.X = btn4.Right; |
| | | btn6.Y = btn3.Bottom; |
| | | btn6.X = btn5.Right; |
| | | pdjianFramLayout.AddImageView(); |
| | | pdjianFramLayout.AddNameView(); |
| | | pdjianFramLayout.Y = pdjiaFramLayout.Bottom; |
| | | pdjianFramLayout.GetImageButton().Height = Application.GetRealHeight(32); |
| | | pdjianFramLayout.GetImageButton().Width = Application.GetRealWidth(32); |
| | | pdjianFramLayout.GetImageButton().UnSelectedImagePath = "AksIcon/pindao2.png"; |
| | | pdjianFramLayout.GetNameButton().TextID = StringId.pindaojian; |
| | | pdjianFramLayout.X = btn6.Right; |
| | | btn_jian.Y = btn_jia.Bottom; |
| | | btn_jian.X = btn6.Right; |
| | | |
| | | btn7.Y = btn6.Bottom; |
| | | btn7.X = Application.GetRealWidth(16); |
| | |
| | | btn8.X = btn7.Right; |
| | | btn9.Y = btn6.Bottom; |
| | | btn9.X = btn8.Right; |
| | | btn.Y = pdjianFramLayout.Bottom; |
| | | btn.Y = btn_jian.Bottom; |
| | | btn.X = btn9.Right; |
| | | |
| | | btn0.Y = btn8.Bottom; |
| | | btn0.X = Application.GetRealWidth(16 + 78); |
| | | |
| | | btn1.MouseDownEventHandler += (sen, e) => ClickListener(btn1); |
| | | |
| | | btn2.MouseDownEventHandler += (sen, e) => ClickListener(btn2); |
| | | |
| | | btn3.MouseDownEventHandler += (sen, e) => ClickListener(btn3); |
| | | |
| | | btn4.MouseDownEventHandler += (sen, e) => ClickListener(btn4); |
| | | |
| | | btn5.MouseDownEventHandler += (sen, e) => ClickListener(btn5); |
| | | |
| | | btn6.MouseDownEventHandler += (sen, e) => ClickListener(btn6); |
| | | |
| | | btn7.MouseDownEventHandler += (sen, e) => ClickListener(btn7); |
| | | |
| | | btn8.MouseDownEventHandler += (sen, e) => ClickListener(btn8); |
| | | |
| | | btn9.MouseDownEventHandler += (sen, e) => ClickListener(btn9); |
| | | |
| | | btn0.MouseDownEventHandler += (sen, e) => ClickListener(btn0); |
| | | |
| | | btn.MouseDownEventHandler += (sen, e) => ClickListener(btn); |
| | | |
| | | btn_jia.MouseDownEventHandler += (sen, e) => ClickListener(btn_jia); |
| | | |
| | | btn_jian.MouseDownEventHandler += (sen, e) => ClickListener(btn_jian); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | private void ClickListener(Button button) |
| | | { |
| | | if (button == null) |
| | | { |
| | | return; |
| | | } |
| | | button.BackgroundColor = DownBackgroundColor; |
| | | action?.Invoke(button); |
| | | button.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | button.BackgroundColor = UpBackgroundColor; |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 事件监听方法 |
| | | /// </summary> |
| | | /// <param name="action">回调(点击控件对象</param> |
| | | public void SetClickListener(Action<Button> action) |
| | | { |
| | | this.action = action; |
| | | } |
| | | |
| | | } |
| | | } |