using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 做成一个列表型的FrameLayout(它与VerticalListControl同一性质,但是它是FrameLayout,它会改变高度)
|
/// </summary>
|
public class FrameListControl : FrameLayout
|
{
|
/// <summary>
|
/// 行之间的间距
|
/// </summary>
|
public int rowSpace = 0;
|
|
/// <summary>
|
/// 做成一个列表型的FrameLayout(它与VerticalListControl同一性质,但是它是FrameLayout,它会改变高度)
|
/// </summary>
|
/// <param name="i_rowSpace">行之间的间距(这个值是与行控件绑定一起使用的)</param>
|
public FrameListControl(int i_rowSpace = 12)
|
{
|
rowSpace = Application.GetRealHeight(i_rowSpace);
|
}
|
|
/// <summary>
|
/// 添加子控件
|
/// </summary>
|
/// <param name="view"></param>
|
public override void AddChidren(View view)
|
{
|
if (view is FrameRowControl || view is RowLayoutControl)
|
{
|
//FrameRowLayout控件的时候,直接扩大它的高度
|
var tempView = this.GetChildren(this.ChildrenCount - 1);
|
if (tempView != null)
|
{
|
view.Y = tempView.Bottom;
|
}
|
base.AddChidren(view);
|
if (rowSpace > 0)
|
{
|
view.Height += rowSpace;
|
}
|
}
|
else
|
{
|
//非FrameRowLayout控件的时候,计算的是坐标
|
var tempView = this.GetChildren(this.ChildrenCount - 1);
|
if (tempView != null)
|
{
|
view.Y = tempView.Bottom + rowSpace;
|
}
|
base.AddChidren(view);
|
}
|
}
|
}
|
}
|