12

I've got a ProgressDialog that I have positioned to the bottom of my screen as to not overlap a logo. What I would like to do is create a custom style for the ProgressDialog that removes the background and the border. I'm not having any luck here.

Does anyone have a clue on how to apply this style?

Macarse
  • 91,829
  • 44
  • 175
  • 230
madzilla
  • 352
  • 2
  • 4
  • 12

3 Answers3

10

Have you tried setting the background to a transparent color?

This answer gives a detailed code sample.

Community
  • 1
  • 1
Matthew
  • 44,826
  • 10
  • 98
  • 87
  • Doesn't seem to work if I just style an out of the box ProgressDialog, it simply ignores the styles. I'll try to extend my own custom dialog and see if that'll do. – madzilla Mar 13 '11 at 23:12
2

You can use an image for progress dialog and customize as you wish like-

         // Custom position Of image Loader
          WindowManager.LayoutParams wmlp =
          pDialog.getWindow().getAttributes(); int height =
          getResources().getDisplayMetrics().heightPixels; wmlp.y =
          height/4; pDialog.getWindow().setAttributes(wmlp);

For more details please follow the link below:

http://androiddubd.blogspot.com/2014/09/how-to-create-transparent-progress.html

Md. Ilyas Hasan Mamun
  • 1,848
  • 2
  • 24
  • 15
2

This can help you (worked for me):

Create a layout in res/layout, like this (named, for example, as progressbar.xml):

<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" >

   <ProgressBar
      android:id="@+id/progressBar"
      style="?android:attr/progressBarStyleLarge"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true" />
</RelativeLayout>

Then, put this code in your Activity or Fragment:

private ProgressDialog progressDialog;

// the first parameter (this) is your activity
// ... but if you need to use this code in a Fragment, use getActivity() instead 
progressDialog = ProgressDialog.show(this,null,null);  
progressDialog.setContentView(R.layout.progressbar);

So, the ProgressDialog will to show without background and border.

Filipe Brito
  • 5,329
  • 5
  • 32
  • 42