Search code examples
androidprogressdialog

How to customize the Progress Dialog in Android


I am implementing the progress dialog customization. In this I am adding the styles and colors.

 <style name="ProThemeOrange" parent="@android:style/Theme.Dialog">
    <item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
    <item name="android:textColorPrimary">#e6e6e6</item>
    </style>

    <style name="CustomAlertDialogStyle">

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

And I am adding the style to ProgressDialog.

ProgressDialog pd = new ProgressDialog(this, R.style.ProThemeOrange);

I am getting the background color but on the top of progress dialog I'm getting black Color. enter image description here

I referred this link

I need total background color as crimsonred.


Solution

  • <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    
    <RelativeLayout
        android:layout_width="135dp"
        android:layout_height="56dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="146dp"
        android:background="#e64b3c"
        android:orientation="horizontal" >
    
        <ProgressBar
            android:id="@+id/progressBar1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/progressBar1"
            android:text="Please wait..." />
    
    </RelativeLayout>