using System; using System.Collections.Generic; using System.Text; namespace Shared.Phone.UserCenter { /// /// 信息编辑控件(不建议别人使用) /// public class InformationEditorControl { /// /// 初始化控件(返回的是信息容器控件) /// /// bodyFrameLayout /// 标题文本 /// bodyFrameLayout里面的Y轴坐标 /// 蓝湖UI里面它的高度 /// 信息容器控件 public VerticalListControl InitControl(FrameLayout bodyFrameLayout, string title, int Y, int Height) { //弧度的圆的一半的高度(固定) int halfRoundHeigth = Application.GetRealHeight(116) / 2; //弧度的圆 var btnRound = new NormalViewControl(bodyFrameLayout.Width, halfRoundHeigth * 2, false); btnRound.Y = Application.GetRealHeight(Y); btnRound.BackgroundColor = UserCenterColor.Current.White; btnRound.Radius = (uint)halfRoundHeigth; bodyFrameLayout.AddChidren(btnRound); //明细列表的桌布,白色背景(覆盖弧度的圆的半边) var detailBackFrame = new FrameLayout(); detailBackFrame.Y = btnRound.Bottom - btnRound.Height / 2; detailBackFrame.Height = Application.GetRealHeight(Height);//高度就是要它超过 detailBackFrame.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(detailBackFrame); //信息编辑 var btnTile = new NormalViewControl(800, 60, true); btnTile.X = ControlCommonResourse.XXLeft; btnTile.TextSize = 15; btnTile.TextColor = UserCenterColor.Current.TextColor2; btnTile.Text = title; detailBackFrame.AddChidren(btnTile); var listview = new VerticalListControl(12); listview.Y = btnTile.Bottom + Application.GetRealHeight(17); listview.Height = Application.GetRealHeight(Height) - halfRoundHeigth - btnTile.Bottom - Application.GetRealHeight(17); detailBackFrame.AddChidren(listview); return listview; } /// /// 完成初始化(当行数多的时候,这个函数很有用。行数不超过容器时,调不调用这个函数都没事) /// /// bodyFrameLayout /// 容器控件 public void FinishInitControl(FrameLayout bodyFrameLayout, VerticalListControl listview) { var btnFinish = new BottomClickButton(); //借用Y轴坐标(让这个区域不能点击菜单) //var frameBack = new FrameLayout(); //frameBack.Y = btnFinish.Yaxis; //frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis; //bodyFrameLayout.AddChidren(frameBack); if (listview.ChildrenCount > 0) { var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount; if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height) { //促使被挡住的菜单能够向上滑动 var frameTemp = new FrameLayout(); //frameTemp.Height = frameBack.Height + Application.GetRealHeight(115); frameTemp.Height = bodyFrameLayout.Height - btnFinish.Yaxis + Application.GetRealHeight(115); listview.AddChidren(frameTemp); } } } } }