/ /アクティビティを変更するたびに、下部と上部のバーが読み込まれます-android、android-layout、android-studio、bottomnavigationview

アンドロイド、アンドロイドのレイアウト、アンドロイドのスタジオ、ボトムナビゲーションのビューを変更するたびに、下部と上部のバーが読み込まれます

BottomNavigationViewEXを使用していますが、このバーのボタンの1つをクリックするたびに、ページ全体が読み込まれ、下部と上部のバーも読み込まれます。

これは、各アクティビティで使用しているコードです。

private void setupBottomNavigationView() {
Log.d(TAG, "setupBottomNavigationView: setting up BottomNavigationView");
BottomNavigationViewEx bottomNavigationViewEx = (BottomNavigationViewEx) findViewById(R.id.BottomNavViewBar);
BottomNavigationViewHelper.setupBottomNavigationView(bottomNavigationViewEx);
BottomNavigationViewHelper.enableNavigation(HomeActivity.this, bottomNavigationViewEx);
Menu menu = bottomNavigationViewEx.getMenu();
MenuItem menuItem = menu.getItem(ACTIVITY_NUM);
menuItem.setChecked(true);
}

ボトム バーをすべてのアクティビティではなく 1 つのアクティビティでセットアップする必要があると確信していますが、Android Studio の初心者なので、それを実現する方法がわかりません。

ご協力ありがとうございます。必要な情報をできるだけ多く提供します。

編集 1: これは activity_popcore.xml です

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
tools:context=".popcore">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<!-- Top Bar -->

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relLayout1">

<include layout="@layout/layout_top_tabs"/>

</RelativeLayout>

<!-- Body -->

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/relLayout2"
android:layout_below="@+id/relLayout1">



<include layout="@layout/layout_center_viewpager"/>

</RelativeLayout>

<!-- Bottom Bar -->

<include layout="@layout/layout_bottom_navigation_view"/>

</RelativeLayout>

これが私のlayout_bottom_navigation_view.xmlです:

<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true">

<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/BottomNavViewBar"
android:background="@drawable/dark_grey_border_top"
app:itemIconTint="@color/bottom_nav_item_colors"
app:itemTextColor="@color/bottom_nav_item_colors"
app:menu="@menu/bottom_navigation_menu">

</com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx>

</RelativeLayout>

さらに情報が必要な場合は、私に聞いてください。助けてくれてありがとう!

回答:

回答№1は0

問題はここではないと思います。問題を特定するには、アクティビティ/フラグメントの onResume() ブロックを分析する必要があると思います。そしてもっと情報を提供してください。