设置一直转圈的UI进度

//自己设置一个framelayout或者用content
  FrameLayout rootContainer = findViewById(R.id.llContainer);
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        // 设置对其方式为:屏幕居中对其
        lp.gravity = Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL;
        ProgressBar dialog = new ProgressBar(this);
        dialog.setVisibility(View.VISIBLE);
        dialog.setLayoutParams(lp);
        //一直转动的圈圈
dialog.setIndeterminateDrawable(this.getResources().getDrawable(R.drawable.loading_progress_draw));
        dialog.setBackgroundResource(R.mipmap.loading_test_bg);
        // 自定义小菊花
        rootContainer.isShown();
        rootContainer.addView(dialog);
        dialog.setVisibility(View.VISIBLE);

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容