Navigation View Always Visible in Android

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 want to open navigation view with bottom app bar click. But navigation view always visible .

My layout xml :

xml version="1.0" encoding="utf-8"?>
 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:id="@+id/drawer_layout"
    android:theme="@style/ThemeOverlay.MaterialComponents.Light"
    >


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


    
        android:id="@+id/relativeLayout2"
        android:layout_width="match_parent"
        android:layout_height="132dp"
        android:background="@drawable/login_bg2_gradient"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

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


            
                android:id="@+id/imageView5"
                android:layout_width="45dp"
                android:layout_height="44dp"
                android:layout_alignParentStart="true"
                android:layout_alignParentEnd="true"
                android:layout_alignParentBottom="true"
                android:layout_marginStart="8dp"
                android:layout_marginTop="24dp"
                android:layout_marginEnd="8dp"
                app:layout_constraintBottom_toTopOf="@+id/textView"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintVertical_chainStyle="spread_inside"
                app:srcCompat="@drawable/logo" />

            
                android:id="@+id/textView"
                android:layout_width="91dp"
                android:layout_height="23dp"
                android:layout_alignParentStart="true"
                android:layout_alignParentEnd="true"
                android:layout_alignParentBottom="true"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:text="SAMET DAĞ"
                app:layout_constraintBottom_toTopOf="@+id/textView7"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/imageView5" />

            
                android:id="@+id/textView7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_alignParentEnd="true"
                android:layout_alignParentBottom="true"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:layout_marginBottom="22dp"
                android:text="8 Şubat 2019 11:05"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/textView" />

            
                android:id="@+id/textView8"
                android:layout_width="69dp"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_marginStart="4dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom
                                                
                                                
0 views
0 shares
profilepic.png
manpreet 2 years ago

You are opening it when you start activity. Please remove the line in onCreate method

drawerLayout.openDrawer(GravityCompat.START);

and change

android:layout_gravity="end"

to

android:layout_gravity="start"

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.