androidandroid-layoutandroid-resources

How can I customize Android ProgressDialog?


How can I completely customize Android ProgressDialog? I want to use Horizontal Style but with AdMob banner ad or rectangle ad within the dialog. According to me, I have to create custom style and resource file for the dialog. How can I do that?

But I want the horizontal progress bar as it is.

Current code:

       progressDialog.setTitle("Downloading...");

       progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        progressDialog.setMax(100);
        progressDialog.setProgress(0);
        progressDialog.show();
       progressDialog.setCancelable(true);

Solution

  • Use a progress bar and the admob view in a custom xml view shown using a alert dialog

           AlertDialog.Builder builderVal=new AlertDialog.Builder(this);
            builderVal.setTitle("Loading") ;
            View holder=View.inflate(mContext, R.layout.your_view.xml, null);
            builderVal.setView(holder);
    
           AdView xs = ( AdView) holder.findViewById(R.id.admobView);
           //use your admob view
           ProgressBar pb = ( ProgressBar)holder.findViewById(R.id.progressBar);
           //use your progressbar
    
            builderVal.show();