Created
February 15, 2021 13:50
-
-
Save abircse/962504285bc843ab288ea8a8fb59f6fc to your computer and use it in GitHub Desktop.
ProgressDialogLoading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a Class file Called ProgressDialog & past below code | |
--------------------------------------------------------------- | |
class ProgressDialog(private val context: Context) { | |
private var dialog: Dialog? = null | |
fun showProgressDialog() { | |
dialog = Dialog(context) | |
dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) | |
dialog!!.setCancelable(false) | |
dialog!!.setContentView(your_progress_dialog_xml_layout) | |
dialog!!.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | |
dialog!!.show() | |
} | |
fun hideProgressDialog() { | |
dialog!!.dismiss() | |
} | |
} | |
2. Create a xml layout & Set below code | |
------------------------------------------ | |
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:background="@drawable/progressdialog_roundbackound"> | |
<ProgressBar | |
:) All Are Set | |
android:layout_width="30dp" | |
android:indeterminateTint="@color/colorPrimary" | |
android:layout_height="30dp" | |
android:layout_margin="10dp" /> | |
</FrameLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment