Android /将导航抽屉与首页活动分开会重叠内容

时间:2019-09-15 19:24:18

标签: android navigation-drawer layout-inflater android-inflate setcontentview

我试图将导航抽屉与主页活动分开,以便在所有其他活动中共同使用。 但是,这样做的时候,我尝试更换

setContentView(R.layout.home);

在Home.java中,

LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

@SuppressLint("InflateParams")
View contentView = inflater.inflate(R.layout.home, null, false);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.addView(contentView, 0);

主页活动中的内容相互重叠,并且列表项不再可单击。

enter image description here

如何解决此问题?我要去哪里错了?请帮忙。

完整的源代码位于:

https://bitbucket.org/pradeep-melorra/melorra-android-native/src/development/app/src/main/java/com/melorra/nativeapp/Home.java

您还可以随意引用同一项目本身中的其他文件。

0 个答案:

没有答案