0

I have a navigation view and it works well but I want to make a small arrow next to it just to let the user know that he can swipe that arrow to the right to see the navigation menu options. I tried to play with margins and put the arrow vector asset inside the navigation view but that didn't work because I also want the user to hide it when he wants to.

That's my simple xml code:

   android:id="@+id/drawer_nav"
   android:layout_width="wrap_content"
   android:layout_height="match_parent"
   android:background="@color/black"
   app:menu="@menu/navigation"
   app:itemTextColor="@color/white"
   app:itemIconTint="@color/white"
   android:layout_gravity="start"
   /> 

I also tried to have my arrow between the tags of navigation view like this but that didn't work as well.. It showed me the place of the icon just where I want it to be but the icon itself ( the arrow ) somehow disappeared :(

<com.google.android.material.navigation.NavigationView
        android:id="@+id/drawer_nav"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="@color/black"
        app:menu="@menu/navigation"
        app:itemTextColor="@color/white"
        app:itemIconTint="@color/white"
        android:layout_gravity="start">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/arrowopenClose"
            android:layout_width="20dp"
            android:layout_height="30dp"
            android:layout_marginEnd="-20dp"
           android:layout_marginTop="400dp"
            android:layout_gravity="right"
            android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
            android:background="@drawable/customarrow"
            android:clickable="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </com.google.android.material.navigation.NavigationView>


</androidx.drawerlayout.widget.DrawerLayout>

Here is a picture of what I want

NaFa
  • 15
  • 4
  • It is not clear where do you want to put the arrow pic.. Can you show some photo for that – Zain Sep 26 '21 at 22:46
  • I just updated the post .. as you can see in the photo there is small arrow to the right if you drag it or click it the sided list will show .. That's all I need . It's been a long time of trying :( – NaFa Sep 26 '21 at 23:09
  • This can help you out https://stackoverflow.com/questions/18768360/draggable-drawer-with-a-handle-instead-of-action-bar-on-top-of-other-apps – Zain Sep 26 '21 at 23:24

0 Answers0