Si vous voulez ProgressBar que dans la boîte de dialogue définir cette classe
public class ProgressDialog {
private Dialog dialog;
private static ProgressDialog mInstance;
public static synchronized ProgressDialog getInstance() {
if (mInstance == null) {
mInstance = new ProgressDialog();
}
return mInstance;
}
public void show(Context context) {
if (dialog != null && dialog.isShowing()) {
return;
}
dialog = new Dialog(context,R.style.ProgressDialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.layout_progress_dialog);
dialog.setCancelable(false);
dialog.show();
}
public void dismiss() {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
}
}
et ce XML dans le dossier de mise en page
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/progress"
android:id="@+id/progress" />
</LinearLayout>
et ce style dans style.xml
<style name="ProgressDialog" parent="Animation.AppCompat.Dialog">
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:background">@android:color/transparent</item>
</style>
Merci, il est travail .. –
Puis Up-vote It: D –
Déjà fait ..;) –