Introducing a non-blocking progress dialogue such as playstore and facebook

I use custom progressDialog in my application, where I use animation-list to display a moving image, but what I want to do is insert my progressDialog into my activity so that it does not overlap the screen, and when the task is completed, the view will be be updated, while the completion of the click will be completed.

+4
source share
1 answer

Create a ProgressDialog in your activity and hide another layout.

 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/content" android:visibility="gone" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView style="?android:textAppearanceMedium" android:lineSpacingMultiplier="1.2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/lorem_ipsum" android:padding="16dp" /> </ScrollView> <ProgressBar android:id="@+id/loading_spinner" style="?android:progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </FrameLayout> 

After receiving data from a network call, hide the ProgressBar and show your data.

0
source

Source: https://habr.com/ru/post/1489968/


All Articles