android自定义进度对话框背景

时间:2014-01-28 14:29:11

标签: android progressdialog

伙计我怎么能做这样的全屏进度对话

enter image description here

我试试这个

<style name="MyDialog" parent="@android:style/Theme.Dialog">
        <item name="android:background">@color/loadActivitybackgr</item>
        <item name="android:textColor">#FFFFFF</item>
        <item name="android:windowBackground">@null</item>
        <item name="android:windowFrame">@null</item>
    </style>

但这不是我需要的(

2 个答案:

答案 0 :(得分:2)

您不需要使用样式。创建自定义布局并显示它。

例如:

<强> RES /布局/ progess.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0000FF" >

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

</RelativeLayout>

<强> MainActivity.java

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.progress);
    }
}

答案 1 :(得分:0)

将此代码放在需要进度对话框的位置

progressDialog = new ProgressDialog(activity); 
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
progressDialog.setIcon(android.R.drawable.ic_dialog_info); 
progressDialog.setTitle("Carregando..."); 
progressDialog.setMessage("Obtendo palestras, aguarde..."); 
progressDialog.setCancelable(false); 
progressDialog.setIndeterminate(true); 
progressDialog.show();