4

I used the following code to change the background of Progress Dialog. But the color changes on the outside frame too as below. I want to change only inside the dialog.

<style name="StyledDialog" parent="@android:style/Theme.Panel">
    <item name="android:background">#083044</item>
</style>

enter image description here

As per the answer given at this question Change background of ProgressDialog

<style name="StyledDialog" parent="@android:style/Theme.Dialog">
    <item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
    <item name="android:textColorPrimary">#000000</item>
</style>
<style name="CustomAlertDialogStyle">
    <item name="android:bottomBright">@color/background</item>
    <item name="android:bottomDark">@color/background</item>
    <item name="android:bottomMedium">@color/background</item>
    <item name="android:centerBright">@color/background</item>
    <item name="android:centerDark">@color/background</item>
    <item name="android:centerMedium">@color/background</item>
    <item name="android:fullBright">@color/background</item>
    <item name="android:fullDark">@color/background</item>
    <item name="android:topBright">@color/background</item>
    <item name="android:topDark">@color/background</item>
</style>

This code gives background color perfect. But since, dialog color and activity's background color is same. It appears like transparent with no border. I want some border as before.

enter image description here

Community
  • 1
  • 1
Ram Babu
  • 2,692
  • 3
  • 23
  • 28
  • 4
    [http://stackoverflow.com/questions/13347539/change-background-of-progressdialog](http://stackoverflow.com/questions/13347539/change-background-of-progressdialog) – M D Jan 22 '15 at 04:27
  • I am now having a perfect answer. But this question is marked as duplicate, I cannot add answer. Let me add Later. – Ram Babu Jan 22 '15 at 23:42

2 Answers2

5
 <style name="CustomAlertDialogStyle">
    <item name="android:bottomBright">@color/transparent</item>
    <item name="android:bottomDark">@color/transparent</item>
    <item name="android:bottomMedium">@color/transparent</item>
    <item name="android:centerBright">@color/transparent</item>
    <item name="android:centerDark">@color/transparent</item>
    <item name="android:centerMedium">@color/transparent</item>
    <item name="android:fullBright">@color/transparent</item>
    <item name="android:fullDark">@color/transparent</item>
    <item name="android:topBright">@color/transparent</item>
    <item name="android:topDark">@color/transparent</item>
</style>

<style name="StyledDialog" parent="@android:style/Theme.Panel">
    <item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
    <item name="android:background">@color/darkblue</item>
</style>
Akshay
  • 6,029
  • 7
  • 40
  • 59
  • This code @color/darkblue makes background color perfect. But since, dialog color and activity's background color is same. It appears like transparent with no white border. I've derived the another answer from your answer and worked perfect. Thanks. – Ram Babu Jan 22 '15 at 23:26
2

Try like this.

<style name="StyledDialog" parent="@android:style/Theme.Panel">
    <item name="android:background">@android:color/transparent</item>
    <item name="android:alertDialogStyle">@style/CustomStyle</item>
</style>

<style name="CustomStyle">
    <item name="android:bottomBright">#083044/item>
    <item name="android:bottomDark">#083044</item>
    <item name="android:bottomMedium">#083044</item>
    <item name="android:centerBright">#083044</item>
    <item name="android:centerDark">#083044</item>
    <item name="android:centerMedium">#083044</item>
    <item name="android:fullBright">#083044</item>
    <item name="android:fullDark">#083044</item>
    <item name="android:topBright">#083044</item>
    <item name="android:topDark">#083044</item>
</style>
W I Z A R D
  • 1,224
  • 3
  • 17
  • 44
  • This code makes background color perfect. But since, dialog color and activity's background color is same. It appears like transparent with no white border. I've derived the another answer from your answer and worked perfect. Thanks. – Ram Babu Jan 22 '15 at 23:51