iCaesar
iCaesar

Reputation: 411

android custom progress dialog background

guys how can i do such fullscreen progress dialog

enter image description here

i try this

<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>

but it is not that i need (

Upvotes: 0

Views: 3344

Answers (2)

sivaBE35
sivaBE35

Reputation: 1891

put this code where you need progress dialog

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(); 

Upvotes: 0

Simulant
Simulant

Reputation: 20112

You don't need to use a style. create a custom layout and display it.

For Example:

res/layout/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);
    }
}

Upvotes: 2

Related Questions