0

I have a Bottomsheetdialog, that wont change to darkmode nor change language. Am i doing something wrong? The onclick listener is working tho. kotlin code:

private fun outsideDoorModalShow() {
        val bottomSheetDialog = BottomSheetDialog(activity, R.style.BottomSheetDialogTheme)
        val bottomSheetView = LayoutInflater.from(activity.applicationContext).inflate(
                R.layout.outside_door_bottom_modal
                , null
        )

        bottomSheetDialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
        bottomSheetView.findViewById<Button>(R.id.order_outside_door_button_order).setOnClickListener { orderOutsideDoor(bottomSheetDialog) }
        bottomSheetDialog.setContentView(bottomSheetView)
        bottomSheetDialog.show()
    }

xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/outside_door_modal_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bottom_sheet_background"
    android:orientation="vertical">


/.../


    <Button
        android:id="@+id/order_outside_door_button_order"
        style="@style/OnboardingButtonAppearance"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="32dp"
        android:text="@string/order" />

</LinearLayout>

Meyben
  • 451
  • 3
  • 15

1 Answers1

0

figured it out. Had to replace

val bottomSheetView = LayoutInflater.from(activity.applicationContext).inflate(
                R.layout.outside_door_bottom_modal
                , null
        )

with

val bottomSheetView = LayoutInflater.from(activity).inflate(
                R.layout.outside_door_bottom_modal
                , null
        )

```
Meyben
  • 451
  • 3
  • 15