old mode 100755
new mode 100644
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 做成一个里面只装FrameLayout的列表型控件,有刷新功能(有桌布,它不会调整高度)
|
| | | /// </summary>
|
| | | public class VerticalFrameRefreshControl : VerticalRefreshLayout
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 行之间的间距
|
| | | /// </summary>
|
| | | public int rowSpace = 0;
|
| | | /// <summary>
|
| | | /// 桌布控件
|
| | | /// </summary>
|
| | | private NormalFrameLayout m_frameTable = null;
|
| | | /// <summary>
|
| | | /// 桌布控件
|
| | | /// </summary>
|
| | | public NormalFrameLayout frameTable
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_frameTable == null) { this.InitFrameTable(); }
|
| | | return m_frameTable;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 一个临时的东西
|
| | | /// </summary>
|
| | | private FrameLayout frameBackTemp = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 做成一个列表型的FrameLayout,有刷新功能(它不会调整高度)
|
| | | /// </summary>
|
| | | /// <param name="i_rowSpace">行之间的间距(这个值是与行控件绑定一起使用的)</param>
|
| | | public VerticalFrameRefreshControl(int i_rowSpace = 0)
|
| | | {
|
| | | rowSpace = Application.GetRealHeight(i_rowSpace);
|
| | | this.VerticalScrollBarEnabled = false;
|
| | | #if iOS
|
| | | //自动偏移取消
|
| | | if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
|
| | | {
|
| | | (this.uiView as UIKit.UIScrollView).ContentInsetAdjustmentBehavior = UIKit.UIScrollViewContentInsetAdjustmentBehavior.Never;
|
| | | }
|
| | | #endif
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化桌布控件
|
| | | /// </summary>
|
| | | private void InitFrameTable()
|
| | | {
|
| | | if (this.m_frameTable != null && this.m_frameTable.Parent != null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | this.m_frameTable = new NormalFrameLayout();
|
| | | this.m_frameTable.Width = this.Width;
|
| | | this.m_frameTable.Height = this.Height;
|
| | | base.AddChidren(this.m_frameTable);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加子控件_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加子控件(注意,它是往下加控件,此方法是只改变Y轴)
|
| | | /// </summary>
|
| | | /// <param name="view"></param>
|
| | | public override void AddChidren(View view)
|
| | | {
|
| | | //初始化桌布控件
|
| | | this.InitFrameTable();
|
| | |
|
| | | int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
|
| | | if (value != -1)
|
| | | {
|
| | | view.Y = value + rowSpace;
|
| | | }
|
| | | this.m_frameTable.AddChidren(view);
|
| | | //调整桌布高度
|
| | | if (this.m_frameTable.Height < view.Bottom)
|
| | | {
|
| | | this.m_frameTable.Height = view.Bottom;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加子控件(注意,它是往下加控件,此方法是改变高度)
|
| | | /// </summary>
|
| | | /// <param name="view"></param>
|
| | | public void AddChidren2(View view)
|
| | | {
|
| | | //初始化桌布控件
|
| | | this.InitFrameTable();
|
| | |
|
| | | //获取坐标底部最下面的那个控件的底部坐标
|
| | | int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
|
| | | if (value != -1)
|
| | | {
|
| | | view.Y = value;
|
| | | }
|
| | | this.m_frameTable.AddChidren(view);
|
| | | if (rowSpace > 0)
|
| | | {
|
| | | view.Height += rowSpace;
|
| | | }
|
| | | //调整桌布高度
|
| | | if (this.m_frameTable.Height < view.Bottom)
|
| | | {
|
| | | this.m_frameTable.Height = view.Bottom;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 调整子FrameLayout的高度
|
| | | /// </summary>
|
| | | /// <param name="frame"></param>
|
| | | /// <param name="buttomSpace">底部空白间距(真实值)</param>
|
| | | public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace)
|
| | | {
|
| | | //获取坐标底部最下面的那个控件的底部坐标
|
| | | int value = this.GetLocationMostLastViewBottom(frame);
|
| | | if (value != -1)
|
| | | {
|
| | | //调整桌布高度
|
| | | frame.Height = value + buttomSpace;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 调整桌布高度
|
| | | /// </summary>
|
| | | /// <param name="buttomSpace">底部空白间距(真实值)</param>
|
| | | public void AdjustTableHeight(int buttomSpace = 0)
|
| | | {
|
| | | //2020.05.25追加
|
| | | if (this.frameBackTemp != null && this.frameBackTemp.Parent != null)
|
| | | {
|
| | | this.frameBackTemp.RemoveFromParent();
|
| | | }
|
| | |
|
| | | //获取坐标底部最下面的那个控件的底部坐标
|
| | | int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
|
| | | if (value != -1)
|
| | | {
|
| | | //调整桌布高度
|
| | | this.m_frameTable.Height = value + buttomSpace;
|
| | | }
|
| | | else
|
| | | {
|
| | | //还原为原来的高度
|
| | | this.RecoverTableHeight();
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 针对底部点击按钮,调整控件真实高度
|
| | | /// </summary>
|
| | | /// <param name="correctionsValue">Y轴补正值(真实值,列表控件不在bodyFramelayout的时候使用)</param>
|
| | | public void AdjustRealHeightByBottomButton(int correctionsValue = 0)
|
| | | {
|
| | | //调整桌布高度 2020.05.25追加
|
| | | this.AdjustTableHeight();
|
| | |
|
| | | var btnTemp = new BottomClickButton();
|
| | | if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue)
|
| | | {
|
| | | //没有超过
|
| | | return;
|
| | | }
|
| | | //添加临时控件,直至可以滑动超过底部按钮
|
| | | int oldRowSpace = this.rowSpace;
|
| | | this.rowSpace = 0;
|
| | |
|
| | | this.frameBackTemp = new FrameLayout();
|
| | | frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23);
|
| | | this.AddChidren(frameBackTemp);
|
| | |
|
| | | this.rowSpace = oldRowSpace;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 还原桌布高度
|
| | | /// </summary>
|
| | | public void RecoverTableHeight()
|
| | | {
|
| | | if (this.m_frameTable != null)
|
| | | {
|
| | | m_frameTable.Height = this.Height;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取坐标底部最下面的那个控件的底部坐标
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private int GetLocationMostLastViewBottom(FrameLayout frame)
|
| | | {
|
| | | int bottomHeight = -1;
|
| | |
|
| | | if (frame == null) { return bottomHeight; }
|
| | |
|
| | | for (int i = 0; i < frame.ChildrenCount; i++)
|
| | | {
|
| | | var child = frame.GetChildren(i);
|
| | | if (child.Bottom > bottomHeight)
|
| | | {
|
| | | bottomHeight = child.Bottom;
|
| | | }
|
| | | }
|
| | | return bottomHeight;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 做成一个里面只装FrameLayout的列表型控件,有刷新功能(有桌布,它不会调整高度) |
| | | /// </summary> |
| | | public class VerticalFrameRefreshControl : VerticalRefreshLayout |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 行之间的间距 |
| | | /// </summary> |
| | | public int rowSpace = 0; |
| | | /// <summary> |
| | | /// 桌布控件 |
| | | /// </summary> |
| | | private NormalFrameLayout m_frameTable = null; |
| | | /// <summary> |
| | | /// 桌布控件 |
| | | /// </summary> |
| | | public NormalFrameLayout frameTable |
| | | { |
| | | get |
| | | { |
| | | if (m_frameTable == null) { this.InitFrameTable(); } |
| | | return m_frameTable; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 一个临时的东西 |
| | | /// </summary> |
| | | private FrameLayout frameBackTemp = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 做成一个列表型的FrameLayout,有刷新功能(它不会调整高度) |
| | | /// </summary> |
| | | /// <param name="i_rowSpace">行之间的间距(这个值是与行控件绑定一起使用的)</param> |
| | | public VerticalFrameRefreshControl(int i_rowSpace = 0) |
| | | { |
| | | rowSpace = Application.GetRealHeight(i_rowSpace); |
| | | this.VerticalScrollBarEnabled = false; |
| | | #if iOS |
| | | //自动偏移取消 |
| | | if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) |
| | | { |
| | | (this.uiView as UIKit.UIScrollView).ContentInsetAdjustmentBehavior = UIKit.UIScrollViewContentInsetAdjustmentBehavior.Never; |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化桌布控件 |
| | | /// </summary> |
| | | private void InitFrameTable() |
| | | { |
| | | if (this.m_frameTable != null && this.m_frameTable.Parent != null) |
| | | { |
| | | return; |
| | | } |
| | | this.m_frameTable = new NormalFrameLayout(); |
| | | this.m_frameTable.Width = this.Width; |
| | | this.m_frameTable.Height = this.Height; |
| | | base.AddChidren(this.m_frameTable); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 添加子控件_________________________ |
| | | |
| | | /// <summary> |
| | | /// 添加子控件(注意,它是往下加控件,此方法是只改变Y轴) |
| | | /// </summary> |
| | | /// <param name="view"></param> |
| | | public override void AddChidren(View view) |
| | | { |
| | | //初始化桌布控件 |
| | | this.InitFrameTable(); |
| | | |
| | | int value = this.GetLocationMostLastViewBottom(this.frameTable); |
| | | if (value != -1) |
| | | { |
| | | view.Y = value + rowSpace; |
| | | } |
| | | this.frameTable.AddChidren(view); |
| | | //调整桌布高度 |
| | | if (this.frameTable.Height < view.Bottom) |
| | | { |
| | | this.frameTable.Height = view.Bottom; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加子控件(注意,它是往下加控件,此方法是改变高度) |
| | | /// </summary> |
| | | /// <param name="view"></param> |
| | | public void AddChidren2(View view) |
| | | { |
| | | //初始化桌布控件 |
| | | this.InitFrameTable(); |
| | | |
| | | //获取坐标底部最下面的那个控件的底部坐标 |
| | | int value = this.GetLocationMostLastViewBottom(this.frameTable); |
| | | if (value != -1) |
| | | { |
| | | view.Y = value; |
| | | } |
| | | this.frameTable.AddChidren(view); |
| | | if (rowSpace > 0) |
| | | { |
| | | view.Height += rowSpace; |
| | | } |
| | | //调整桌布高度 |
| | | if (this.frameTable.Height < view.Bottom) |
| | | { |
| | | this.frameTable.Height = view.Bottom; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 调整子FrameLayout的高度 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="buttomSpace">底部空白间距(真实值)</param> |
| | | public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace) |
| | | { |
| | | //获取坐标底部最下面的那个控件的底部坐标 |
| | | int value = this.GetLocationMostLastViewBottom(frame); |
| | | if (value != -1) |
| | | { |
| | | //调整桌布高度 |
| | | frame.Height = value + buttomSpace; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调整桌布高度 |
| | | /// </summary> |
| | | /// <param name="buttomSpace">底部空白间距(真实值)</param> |
| | | public void AdjustTableHeight(int buttomSpace = 0) |
| | | { |
| | | //2020.05.25追加 |
| | | if (this.frameBackTemp != null && this.frameBackTemp.Parent != null) |
| | | { |
| | | this.frameBackTemp.RemoveFromParent(); |
| | | } |
| | | |
| | | //获取坐标底部最下面的那个控件的底部坐标 |
| | | int value = this.GetLocationMostLastViewBottom(this.frameTable); |
| | | if (value != -1) |
| | | { |
| | | //调整桌布高度 |
| | | this.frameTable.Height = value + buttomSpace; |
| | | } |
| | | else |
| | | { |
| | | //还原为原来的高度 |
| | | this.RecoverTableHeight(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 针对底部点击按钮,调整控件真实高度 |
| | | /// </summary> |
| | | /// <param name="correctionsValue">Y轴补正值(真实值,列表控件不在bodyFramelayout的时候使用)</param> |
| | | public void AdjustRealHeightByBottomButton(int correctionsValue = 0) |
| | | { |
| | | //调整桌布高度 2020.05.25追加 |
| | | this.AdjustTableHeight(); |
| | | |
| | | var btnTemp = new BottomClickButton(); |
| | | if (btnTemp.Yaxis >= this.frameTable.Height + correctionsValue) |
| | | { |
| | | //没有超过 |
| | | return; |
| | | } |
| | | //添加临时控件,直至可以滑动超过底部按钮 |
| | | int oldRowSpace = this.rowSpace; |
| | | this.rowSpace = 0; |
| | | |
| | | this.frameBackTemp = new FrameLayout(); |
| | | frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23); |
| | | this.AddChidren(frameBackTemp); |
| | | |
| | | this.rowSpace = oldRowSpace; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 还原桌布高度 |
| | | /// </summary> |
| | | public void RecoverTableHeight() |
| | | { |
| | | if (this.m_frameTable != null) |
| | | { |
| | | m_frameTable.Height = this.Height; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取坐标底部最下面的那个控件的底部坐标 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private int GetLocationMostLastViewBottom(FrameLayout frame) |
| | | { |
| | | int bottomHeight = -1; |
| | | |
| | | if (frame == null) { return bottomHeight; } |
| | | |
| | | for (int i = 0; i < frame.ChildrenCount; i++) |
| | | { |
| | | var child = frame.GetChildren(i); |
| | | if (child.Bottom > bottomHeight) |
| | | { |
| | | bottomHeight = child.Bottom; |
| | | } |
| | | } |
| | | return bottomHeight; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |