using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class TopFrameLayout : FrameLayout
|
{
|
#region ◆ 变量__________________________
|
/// <summary>
|
/// 返回键
|
/// </summary>
|
public BackButton backButton;
|
/// <summary>
|
/// 状态栏-高度为80
|
/// </summary>
|
public FrameLayout topStatuFrameLayout;
|
/// <summary>
|
/// The top view.
|
/// </summary>
|
public FrameLayout topView;
|
/// <summary>
|
/// 标题
|
/// </summary>
|
public Button topTitle;
|
|
|
#endregion
|
|
#region ◆ 构造方法_______________________
|
/// <summary>
|
/// 构造方法
|
/// </summary>
|
public TopFrameLayout()
|
{
|
BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor;
|
Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth);
|
Height = Application.GetRealHeight(CommonFormResouce.TopFrameLayout_Height);
|
}
|
|
#endregion
|
|
#region ◆ 初始化__________________________
|
|
public void InitTopview()
|
{
|
//状态栏
|
AddTopStatuFrame();
|
//topview
|
AddTopview();
|
//添加返回键
|
AddBackBtn();
|
//标题
|
AddTitle();
|
}
|
|
#endregion
|
|
#region ◆ topview________________________
|
/// <summary>
|
/// Adds the topview.
|
/// </summary>
|
private void AddTopview()
|
{
|
topView = new FrameLayout
|
{
|
Y = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height),
|
Height = Application.GetRealHeight(CommonFormResouce.Topview_Height),
|
Width = Application.GetRealWidth(CommonPage.AppRealWidth)
|
};
|
AddChidren(topView);
|
|
var line = new Button
|
{
|
Y=Height-1,
|
Height=1,
|
BackgroundColor=ZigbeeColor.Current.GXCGrayLineColor3
|
};
|
AddChidren(line);
|
}
|
|
#endregion
|
|
#region ◆ 返回键__________________________
|
/// <summary>
|
/// 返回键
|
/// </summary>
|
/// <returns>The back button.</returns>
|
private void AddBackBtn()
|
{
|
backButton = new BackButton { };
|
topView.AddChidren(backButton);
|
}
|
|
#endregion
|
|
#region ◆ 状态栏__________________________
|
|
/// <summary>
|
/// 状态栏
|
/// </summary>
|
private void AddTopStatuFrame()
|
{
|
topStatuFrameLayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height),
|
Width = Application.GetRealWidth(CommonPage.AppRealWidth)
|
};
|
AddChidren(topStatuFrameLayout);
|
}
|
|
#endregion
|
|
#region ◆ 标题___________________________
|
/// <summary>
|
/// 标题
|
/// </summary>
|
private void AddTitle()
|
{
|
topTitle = new Button
|
{
|
X=Application.GetRealWidth(164),
|
Height = Application.GetRealHeight(CommonFormResouce.TopFrameLayout_Height - CommonFormResouce.TopStatuFrameLayout_Height),
|
Width = Application.GetRealWidth(CommonFormResouce.TopTitle_Width),
|
TextSize = CommonFormResouce.TopTitle_TextSize,
|
TextColor = ZigbeeColor.Current.GXCTitleBlackTitle,
|
TextAlignment=TextAlignment.CenterLeft
|
};
|
topView.AddChidren(topTitle);
|
}
|
/// <summary>
|
/// 设置标题
|
/// </summary>
|
/// <param name="title">Title.</param>
|
public void SetTopTitle(string title)
|
{
|
topTitle.Text = title;
|
}
|
/// <summary>
|
/// 设置标题
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTopTitle(int title)
|
{
|
SetTopTitle(Language.StringByID(title));
|
}
|
|
#endregion
|
}
|
}
|