I want to change background color of the progressbar having black translucent background with opacity less than 50%. I searched a lot about this but not able to find solution. I don't know whether i'm right or not but it has some thing to do with mdecor property of the progressbar.
Following is the code I am using it.
pd = ProgressDialog.show(getActivity(), null, null,true);
pd.setContentView(R.layout.remove_border);
The code for remove border layout is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:indeterminateDrawable="@drawable/my_progress_indeterminate" />
</LinearLayout>
The code for my_progress_indeterminate is:
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loadingiconblack"
android:pivotX="50%"
android:pivotY="50%" />
Following is the image the background area is marked in red circle. I want to change color to white with same opacity.
EDIT:
Final solution to my issue thanks to Sripathi and user3298272 combining both solutions here is my updated answer:
pd = new Dialog(this, android.R.style.Theme_Black);
View view = LayoutInflater.from(this).inflate(R.layout.remove_border, null);
pd.requestWindowFeature(Window.FEATURE_NO_TITLE);
pd.getWindow().setBackgroundDrawableResource(R.color.transparent);
pd.setContentView(view);
pd.show();
remove_border xml code: Here android:gravity = "center" is added in linear layout code of mine.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:indeterminateDrawable="@drawable/my_progress_indeterminate" />
</LinearLayout>
color xml code:
<resources>
<color name="transparent">#80FFFFFF</color>
</resources>
In #80FFFFFF 80 is the opacity value 50% which i took from user3298272.