1

Im trying to get my bottom navigation bar to be fixed on a side of the screen. Let me use pictures to help you understand what I am hoping to achieve.

How the navigation bar looks when in Portrait and Landscape

As you can see, I am trying to achieve the navigation bar to stay in its same position (i.e. top when in portrait but changed to left in landscape), and the icon buttons in the navigation should be rotated. I remember seeing certain apps do this before but I am unsure... Any help appreciated.

This is the XML code of my navigation bar.

<com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/nav_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/transparent"
                app:elevation="0dp"
                app:itemBackground="@color/transparent"
                app:itemIconTint="@drawable/selector"
                app:itemTextColor="@drawable/selector"
                app:labelVisibilityMode="labeled"
                app:menu="@menu/nav_menu">

            </com.google.android.material.bottomnavigation.BottomNavigationView>
Do Ji
  • 45
  • 1
  • 8

1 Answers1

0

add this to your manifest file:

<activity
 android:name=".whatevernameisyourActivity"
 android:screenOrientation="portrait"
 tools:ignore="LockedOrientationActivity" />

this will force the app not to rotate.

Marius Razvan Varvarei
  • 1,331
  • 1
  • 17
  • 21
  • Thats one possible solution. But if I do this then the device would not detect that its rotated, and if the device does not detect it, the icons on the navigation bar cannot be rotated as well. Do you happen to know the code to rotate the icons on the nav bar? – Do Ji Jul 21 '22 at 01:34