Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change only background color of ProgressDialog without affecting border in Android? [duplicate]

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

like image 925
Ram Babu Avatar asked Mar 17 '23 07:03

Ram Babu


1 Answers

 <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>
like image 171
Akshay Avatar answered Apr 26 '23 10:04

Akshay