如何在两个视图下放置一个视图?
How to place a view under two views?
如果使用标准方法
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.7f, ChartView.ID);
NewsView
将放在 ChartView
下。
但是如何指定一个视图应该放在两个视图之下?
您不能直接这样做,您必须使用单独的 IFolderLayouts 来包含底部、左侧和右侧的视图。
例如:
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.7f, IPageLayout.ID_EDITOR_AREA);
bottom.addView("bottom.view");
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.25f, IPageLayout.ID_EDITOR_AREA);
left.addView("left.view");
IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, 0.7f, IPageLayout.ID_EDITOR_AREA);
right.addView("right.view");
这里首先创建底部文件夹布局使其跨越整个window。
添加视图的顺序很重要,会影响最终的布局。
此代码将在 ChartView
和 TransactionsView
下找到 NewsView
:
layout.addView(ChartView.ID, IPageLayout.RIGHT, 0.2f, InstrumentsView.ID);
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.6f, ChartView.ID);
layout.addView(TransactionsView.ID, IPageLayout.RIGHT, 0.7f, ChartView.ID);
并且此代码将仅在 ChartView
:
下找到 NewsView
layout.addView(ChartView.ID, IPageLayout.RIGHT, 0.2f, InstrumentsView.ID);
layout.addView(TransactionsView.ID, IPageLayout.RIGHT, 0.7f, ChartView.ID);
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.6f, ChartView.ID);
如果使用标准方法
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.7f, ChartView.ID);
NewsView
将放在 ChartView
下。
但是如何指定一个视图应该放在两个视图之下?
您不能直接这样做,您必须使用单独的 IFolderLayouts 来包含底部、左侧和右侧的视图。
例如:
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.7f, IPageLayout.ID_EDITOR_AREA);
bottom.addView("bottom.view");
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.25f, IPageLayout.ID_EDITOR_AREA);
left.addView("left.view");
IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, 0.7f, IPageLayout.ID_EDITOR_AREA);
right.addView("right.view");
这里首先创建底部文件夹布局使其跨越整个window。
添加视图的顺序很重要,会影响最终的布局。
此代码将在 ChartView
和 TransactionsView
下找到 NewsView
:
layout.addView(ChartView.ID, IPageLayout.RIGHT, 0.2f, InstrumentsView.ID);
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.6f, ChartView.ID);
layout.addView(TransactionsView.ID, IPageLayout.RIGHT, 0.7f, ChartView.ID);
并且此代码将仅在 ChartView
:
NewsView
layout.addView(ChartView.ID, IPageLayout.RIGHT, 0.2f, InstrumentsView.ID);
layout.addView(TransactionsView.ID, IPageLayout.RIGHT, 0.7f, ChartView.ID);
layout.addView(NewsView.ID, IPageLayout.BOTTOM, 0.6f, ChartView.ID);