我编写了一个布局(例如,LinearLayout带有工具栏,下面的代码仅作为示例)我希望在新窗口中加载它,就像我开始新意图一样,这样做的正确方法是什么?
protected Void startNewLayout() {
LinearLayout myLayout= new LinearLayout(context);
Toolbar toolbar = new Toolbar(context);
toolbar.setTitle("Page#1");
myLayout.addView(toolbar);
TextView text = new TextView(context);
text.setText("Hello World!");
myLayout.addView(text);
//open myLayout
}