Description
Description: In the Material Design M3 catalog example, if a user has set either 2-button or 3-button navigation mode and switches from portrait to landscape mode, the navigation bar overlaps some UI components on the right / left side of the screen (e.g. back button, menu button, settings button). However, if a user has set gesture navigation mode instead, the UI is not affected by that issue as the system behavior is slightly different.
You can reproduce the issue as follows:
- Switch to either 2-button or 3-button navigation mode on any device / emulator
- Open the Material Design M3 catalog example
- Turn the device / emulator to landscape mode
See below example screenshots that show the issue in various components..
Example 1: 3-button navigation bar on the left side is overlapping the back button / icon
Example 2: 3-button navigation bar on the right side is overlapping the "heart" button / icon
Example 3: 3-button navigation bar on the left side is overlapping the closing button / icon
Example 4: 3-button navigation bar on the right side is overlapping the menu button / icon
Expected behavior: The 2-button and 3-button navigation bars don't overlap the UI components in landscape mode.
Source code: See the catalog example code.
To avoid that issue, you should apply left and right insets for the main view via ViewCompat.setOnApplyWindowInsetsListener
and setPadding
.
Minimal sample app repro: See the catalog example code.
Android API version: As of API 16 up to API 33
Material Library version: 1.7.0-beta01
Device: Any emulator (e.g. Pixel ) or any real device.