ダイアログとして表示されるアクティビティのカスタム ビューがあります。親が「@android:style/Theme.Dialog」であるため、アクティビティにカスタムテーマを適用し、ウィンドウの背景を透明に変更しました。
私のManifest.xml:
<activity android:name="com.rev.revcorder.ui.UserAuthenticationDialogActivity" android:screenOrientation="portrait"
android:theme="@style/userAuthenticationDialog">
</activity>
私のstyles.xml:
<style name="userAuthenticationDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
</style>
問題は、私のデバイス (4.4 を実行している Nexus 4) では正常に動作しているが、私のものと同じ他のデバイス (4.4 を実行している Nexus 4) では動作しないことです。代わりに、背景は透明ではなく黒で表示されます。
以下を追加して文法的に設定した場合にのみ機能しました。
getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00000000")));
私の質問は、xml スタイルでウィンドウの背景を設定することと、文法的に行うことの違いは何ですか? また、別の同じデバイスではなく、なぜ私のデバイスで動作しているのでしょうか?
ご協力いただきありがとうございます