How to center progress indicator in ProgressDialog easily (when no title/text passed along)

后端 未结 8 882
死守一世寂寞
死守一世寂寞 2020-11-28 00:43

When calling progressDialog = ProgressDialog.show(this, null, null, true); usually the developers wants to only show the progress indication image, and usually

8条回答
  •  孤独总比滥情好
    2020-11-28 01:22

    Using ProgressBar and adding it to LinearLayout worked in my Case as follows:

    ProgressBar mSpinner = new ProgressBar(this); 
    mSpinner.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mSpinner.setBackgroundResource(R.drawable.loading_1);
    mSpinner.setIndeterminate(true);
    

    enter image description here

提交回复
热议问题