0

BottomSheetDialogさまざまな活動で使用したいプロジェクトに取り組んでいます。しかし、さまざまな活動のために、ダイアログにさまざまな背景描画可能を持たせたいと思っています。バックグラウンド ドローアブルを設定しましthemes.xmlたが、これによりドローアブルがBottomSheetDialogアプリ全体に適用されます。つまり、正常に適用されますが、すべてのアクティビティで一定です。私が欲しいのは、さまざまなアクティビティに対して、さまざまなバックグラウンド ドローアブルが必要です。

これは私themes.xmlのように見えるものです:

<resources xmlns:tools="http://schemas.android.com/tools">
   <style>
    <!-- Base application theme. -->
         ...
         ...
        <!-- Customize your theme here. -->

        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialogTheme</item>

    </style>

    <style name="AppBottomSheetDialogTheme"
        parent="Theme.Design.Light.BottomSheetDialog">
        <item name="bottomSheetStyle">@style/AppModalStyle</item>
    </style>

    <style name="AppModalStyle"
        parent="Widget.Design.BottomSheet.Modal">
        <item name="android:background">@drawable/top_rounded_corners</item>  <!-- I want to change the backgroundDrawable here. -->
    </style>
</resources>

現在のアクティビティに応じてドローアブルを変更する方法はありますか。使用することを考えAndroidManifest.xmlましたが、どうすればこれを達成できるかわかりません。どんな助けでも大歓迎です。ありがとうございました。

4

1 に答える 1