在自定义进度条,白色背景显示的Andr​​oid。如何删除? [英] In the custom progress bar, white background is showing in Android. How to remove that?

查看:180
本文介绍了在自定义进度条,白色背景显示的Andr​​oid。如何删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个小的图像/图标,这将基本旋转一个自定义进度条。但在后台有白斑或背景显示。我在这里附有影像..

I am making a custom progress bar using one small image/icon which will basically rotate. But in the background there is white patch or background is showing. I have attached the image here..

我用下面的code此:

I have used the below code for this:

 public class CustomDialog extends Dialog{

    public Activity c;
     public CustomDialog(Activity a) {
            super(a);
            // TODO Auto-generated constructor stub
            this.c = a;
          }

     public CustomDialog(Activity a, int s) {
            super(a, s);
            // TODO Auto-generated constructor stub
            this.c = a;
          }

     @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.progressbar);
        setCancelable(true);
      }

}

progressbar.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:orientation="vertical" >

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:indeterminate="true"
        android:background="@android:color/transparent"
        android:indeterminateDrawable="@drawable/my_progress_interminate" >
    </ProgressBar>

</RelativeLayout>

my_progress_interminate.xml

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/sai_icon" 
    android:pivotX="50%"
    android:pivotY="50%" />

我怎样才能去除这里的白色背景..请帮助。

How can i remove the white background here.. Please help.

推荐答案

这是为我工作。添加到您的对话框的OnCreate。

This is working for me. Add this to the onCreate of your dialog.

getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

这篇关于在自定义进度条,白色背景显示的Andr​​oid。如何删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆