Allrast
Allrast

Reputation: 63

Android override default dialog theme

I want to create a custom style for an activity that will look like a dialog. But i want to put this dialog at the top right of the screen, and also set is background to transparent.

I have setted the activity theme to @android:style/Theme.Dialog but now i want to override the existing theme but i have not found this theme in my sdk folder.

Can someone tell me how can i change the default dialog theme?

Upvotes: 2

Views: 11233

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128428

You can define Styles for customizing any View.

For example:

<style name="Theme.Dialog">
    <item name="android:windowFrame">@null</item>
    <item name="android:windowTitleStyle">@android:style/DialogWindowTitle</item>
    <item name="android:windowBackground">@android:drawable/transparent</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
</style>

Upvotes: 11

Related Questions