I am showing a simple Android modal bottom sheet menu. In portrait mode, it works fine, but when the device is rotated to landscape the bottom of the sheet draws under the navigation bar and is hidden. This is using a tablet emulator (Pixel C, API 32).

Portrait mode: correct

[![Portrait mode: correct](https://i.stack.imgur.com/MCpqN.png)](https://i.stack.imgur.com/MCpqN.png)

Landscape mode: bottom of sheet is hidden

[![Landscape mode: bottom of sheet is hidden](https://i.stack.imgur.com/k7We0.png)](https://i.stack.imgur.com/k7We0.png)

Sample code, using the Android Studio "Empty Activity" template project and code from the [Material docs](https://material.io/develop/android/components/bottom-sheet-dialog-fragment#modal-bottom-sheet).

```
class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.showDialog.setOnClickListener { showBottomSheetDialog() }
    }

    private fun showBottomSheetDialog() {
        val modalBottomSheet = ModalBottomSheet()
        modalBottomSheet.show(supportFragmentManager, ModalBottomSheet.TAG)
    }
}

class ModalBottomSheet : BottomSheetDialogFragment() {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? = inflater.inflate(R.layout.bottom_sheet_dialog, container, false)

    companion object {
        const val TAG = "ModalBottomSheet"
    }
}

```

bottom\_sheet\_dialog.xml:

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/text_view_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:paddingVertical="12dp"
        android:text="First Row"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/text_view_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:paddingVertical="12dp"
        android:text="Second Row"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/text_view_3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:paddingVertical="12dp"
        android:text="Third Row"
        android:textSize="16sp" />

</LinearLayout>

```