标题可能有误,对不起。 我使用BottomNavigationView。当我点击一个图标时,我想打开一个不同的活动。我的代码的某些部分如下,这段代码效果很好。
mainactiyity.java
case R.id.navigation_home:
Intent Intent = new Intent(getApplicationContext(), SetData.class);
startActivity(Intent);
return true;
SetData.java
super.onCreate(savedInstanceState);
setContentView(R.layout.set_data);
但我想在BottomNavigationView下打开新活动。新活动涵盖整个屏幕,我看不到导航栏。我该如何解决?
activity.main
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="oww.MainActivity">
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
set_data
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
tools:context=".SetData">
</android.support.percent.PercentRelativeLayout>
答案 0 :(得分:0)