0

画像

したがって、2 つのナビゲーションバーが必要です (下部に 1 つ、上部に 1 つ)。しかし、上の写真ですでにわかるように、地図のために下部にナビゲーション バー用のスペースがありません (ナビゲーション バーは画面の下にあります)。マップの幅と高さをハードコーディングせずに下部のナビゲーション バーを表示するにはどうすればよいですか。

これは私のxmlファイルです:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".Main3Activity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/nav_info"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/bottom_nav_menu" />

    <fragment
        android:id="@+id/map2"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MapsActivity"></fragment>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/nav_viedw"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/bottom_nav_menu" />

</LinearLayout>

4

3 に答える 3