gxc
2019-10-29 081ea8d273048fd03756718ac6fb48a3c09218e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 信息编辑控件(不建议别人使用)
    /// </summary>
    public class InformationEditorControl
    {
        /// <summary>
        /// 初始化控件(返回的是信息容器控件)
        /// </summary>
        /// <param name="bodyFrameLayout">bodyFrameLayout</param>
        /// <param name="title">标题文本</param>
        /// <param name="Y">bodyFrameLayout里面的Y轴坐标</param>
        /// <param name="Height">蓝湖UI里面它的高度</param>
        /// <returns>信息容器控件</returns>
        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;
        }
 
        /// <summary>
        /// 完成初始化(当行数多的时候,这个函数很有用。行数不超过容器时,调不调用这个函数都没事)
        /// </summary>
        /// <param name="bodyFrameLayout">bodyFrameLayout</param>
        /// <param name="listview">容器控件</param>
        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);
                    listview.AddChidren(frameTemp);
                }
            }
        }
    }
}