Skip to content

Instantly share code, notes, and snippets.

@gdacciaro
Created May 22, 2018 13:07
Show Gist options
  • Save gdacciaro/658fa13c2327a3590d36ef230ee1db20 to your computer and use it in GitHub Desktop.
Save gdacciaro/658fa13c2327a3590d36ef230ee1db20 to your computer and use it in GitHub Desktop.
Dialog with custom background color
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_trasparent">#afffffff</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_autoPlay="true"
app:lottie_fileName="loader.json"
app:lottie_loop="true" />
</RelativeLayout>
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import me.pushapp.sosmedico.R;
/**
* Created by Denny on 21/11/2017 with pizza
*/
public class LoadingDialog {
private Dialog dialog;
@SuppressLint("SetTextI18n")
public LoadingDialog(Context context, boolean cancellable) {
dialog = new Dialog(context,R.style.custom_dialog_theme);
dialog.setCancelable(cancellable);
dialog.setContentView(R.layout.custom_dialog_loading);
}
public void show() {
if (dialog != null)
dialog.show();
}
public void dismiss() {
dialog.dismiss();
}
public boolean isShowing(){
return dialog.isShowing();
}
}
<style name="custom_dialog_theme" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowBackground">@color/white_trasparent</item>
<item name="android:windowIsFloating">false</item>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment