【发布时间】:2018-09-11 08:20:24
【问题描述】:
我正在研究导航抽屉布局。必须加载另一个布局来代替 导航项的drawer_layout onClick。
if (id == R.id.nav_camera) {
//code to inflate another layout inplace of current layout
//setContentView(R.layout.another_layout1);
} else if (id == R.id.nav_gallery) {
//code to inflate another layout inplace of current layout
//setContentView(R.layout.another_layout2);
}
如何在主布局中加载另一个布局?
【问题讨论】:
-
使用
Fragments -
如果你想加载不同的布局,然后使用 baseactivty 并在其 oncreate 方法中加载每个布局。!
标签: android android-layout navigation-drawer