问题
I have a custom theme which is applied to the activity:
<style name="Sample" parent="android:Theme">
<item name="android:dialogTheme">@style/Sample.Dialog</item>
</style>
<style name="Sample.Dialog" parent="android:Theme.Dialog">
<item name="android:windowBackground">@drawable/sample_background</item>
</style>
I'm creating a sample Dialog like this:
Dialog dialog = new Dialog(SampleActivity.this);
dialog.setContentView(R.layout.sample_layout);
dialog.show();
My custom dialog style isn't applied. Created dialog still has the standard background. What's wrong here?
回答1:
On initializing :
Dialog dialog = new Dialog(SampleActivity.this, R.style.Sample.Dialog);
来源:https://stackoverflow.com/questions/11332928/android-dialog-custom-style