Skip to content
Advertisement

the menu is not displayed in the xml file already tried everything, nothing works

The main problem is that the menu bar is not displayed in my layout file. I’ve done a few searches but haven’t been able to find a solution or a reason as to why it is behaving this way. Any help would be appreciated. Thanks. my menu file

`<menu xmlns:android="http://schemas.android.com/apk/res/android">
        <item
            android:id="@+id/air"
            android:title="Авиабилеты"
            android:enabled="true"
            android:icon="@drawable/air"/>
        <item
            android:id="@+id/bed"
            android:title="Отели"
            android:enabled="true"
            android:icon="@drawable/bed"/>
        <item
            android:id="@+id/profile"
            android:title="Профиль"
            android:enabled="true"
            android:icon="@drawable/person"/>
    
    </menu>`

XML my layout file

    `<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"
    tools:context="com.example.gototrip.view.MainSearchTicketFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@color/purple_700"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:gravity="center"
            android:text="Поиск дешевых
                          авиабилетов"
            android:textColor="@color/white"
            android:textSize="26sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/fromEditText"
            android:layout_width="336dp"
            android:layout_height="30dp"
            android:layout_gravity="center|center_vertical"
            android:layout_marginStart="100dp"
            android:layout_marginTop="20dp"
            android:layout_marginEnd="101dp"
            android:background="@drawable/rouded_edittext"
            android:ems="10"
            android:hint="Откуда"
            android:inputType="textPersonName"
            android:textSize="24sp"
            app:guidelineUseRtl="true"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:layout_editor_absoluteY="42dp" />

        <EditText
            android:id="@+id/whereEditText"
            android:layout_width="336dp"
            android:layout_height="33dp"
            android:layout_gravity="center|center_vertical"
            android:layout_marginStart="100dp"
            android:layout_marginEnd="101dp"
            android:background="@drawable/rouded_edittext_two"
            android:ems="10"
            android:hint="Куда"
            android:inputType="textPersonName"
            android:textSize="24sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName" />

        <android.support.v7.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:gravity="center">

            <Button
                android:id="@+id/buttonData"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:text="Дата"
                android:textColor="@color/black" />

            <Button
                android:id="@+id/buttonPassenger"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:text="Класс"
                android:textColor="@color/black" />

            <Button
                android:id="@+id/buttonFilter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Фильтр"
                android:textColor="@color/black" />
        </android.support.v7.widget.LinearLayoutCompat>


    </LinearLayout>


    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:itemBackground="@color/black"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/navigation_menu" />


</androidx.constraintlayout.widget.ConstraintLayout>`

Where am I doing wrong? I checked some tutorials, and that exactly the process of setting bottom navigation view photo

Advertisement

Answer

If you do not use the rules of material design, you should not have a theme that inherits from material design. Find the theme.xml according to the Android version of your studio and change the parent to Theme.AppCompat.Light.DarkActionBar.

enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement