Android progress bar embedded in ui and not in dialog box

Is there a way to embed a progress bar in a user interface without a dialog. And not programmatically, but with xml files. I suppose it should be some kind of animation or "extensible"

+6
android progress-bar loading
source share
2 answers

You can use the ProgressBar widget:

 <ProgressBar android:id="@+id/a_progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content"/> 

You can customize it with your own image if you want. You just need to create a styles file (res / styles.xml) as follows:

 <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AProgressBar"> <item name="android:indeterminateDrawable">@drawable/progress_small</item> <item name="android:minWidth">20dip</item> <item name="android:maxWidth">20dip</item> <item name="android:minHeight">20dip</item> <item name="android:maxHeight">20dip</item> </style> </resources> 

@drawable/progress_small refers to an image file named progress_small.png . Then just change your progress bar as follows:

 <ProgressBar android:id="@+id/a_progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/AProgressBar"/> 
+4
source share

Yes, you can use the "ProgressBar" widget in your xml: http://developer.android.com/reference/android/widget/ProgressBar.html

A visual indicator of progress in some operation. Displays a panel for the user showing how far the operation has progressed; An application can change the progress (changing the length of the panel) as it moves forward. The progress bar also shows additional progress, which is useful for displaying intermediate progress, such as the buffer level during the progress bar of the streaming playback.

The progress bar may also be undefined. In indefinite mode, the progress bar shows a looping animation. This mode is used by applications when the length of the task is unknown.

+2
source share

All Articles