using System; using Shared.Common; namespace Shared.Phone.Device.CommonForm { public class TopFrameLayout : FrameLayout { #region ◆ 变量__________________________ /// /// 返回键 /// public UserCenter.BackViewControl backButton; /// /// 状态栏-高度为80 /// public FrameLayout topStatuFrameLayout; /// /// The top view. /// public FrameLayout topView; /// /// 标题 /// public Button topTitle; #endregion #region ◆ 构造方法_______________________ /// /// 构造方法 /// 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________________________ /// /// Adds the topview. /// private void AddTopview() { topView = new FrameLayout { Y = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height), Height = Application.GetRealHeight(CommonFormResouce.Topview_Height), Width = Application.GetRealWidth(CommonPage.AppRealWidth), BackgroundColor=ZigbeeColor.Current.GXCTopViewBackgroundColor }; AddChidren(topView); var line = new Button { Y=Height-1, Height=1, BackgroundColor= UserCenter.UserCenterColor.Current.ButtomLine }; AddChidren(line); } #endregion #region ◆ 返回键__________________________ /// /// 返回键 /// /// The back button. private void AddBackBtn() { backButton = new UserCenter.BackViewControl(); topView.AddChidren(backButton); backButton.InitControl(); //后续再调整 backButton.Y = backButton.Y - Application.GetRealHeight(4); } #endregion #region ◆ 状态栏__________________________ /// /// 状态栏 /// private void AddTopStatuFrame() { topStatuFrameLayout = new FrameLayout { Height = Application.GetRealHeight(CommonFormResouce.TopStatuFrameLayout_Height), Width = Application.GetRealWidth(CommonPage.AppRealWidth) }; AddChidren(topStatuFrameLayout); } #endregion #region ◆ 标题___________________________ /// /// 标题 /// private void AddTitle() { topTitle = new Button(); topTitle.TextSize = 17; topTitle.X = Application.GetRealWidth(161); topTitle.Height = Application.GetRealHeight(75); topTitle.Width = Application.GetRealWidth(850); topTitle.Gravity = Gravity.CenterVertical; topTitle.TextColor = UserCenter.UserCenterColor.Current.TopLayoutTitleText; topTitle.TextAlignment = TextAlignment.CenterLeft; topTitle.IsBold = true; topView.AddChidren(topTitle); } /// /// 设置标题 /// /// Title. public void SetTopTitle(string title) { topTitle.Text = title; } /// /// 设置标题 /// /// public void SetTopTitle(int title) { SetTopTitle(Language.StringByID(title)); } #endregion } }