How can we use custom progress bar with image in android [duplicate] - android

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Custom Progress Bar in Android?
How can we use image with in progress bar like used in that a bucquet image marked by red rectangle.
Please provide me some code for customizing progress bar and use image in that

If you want to set the thumb image of the progressBar moving with the progress then you can you a seekBar and define the thumb image like this
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="50"
android:thumb="#drawable/icon"
/>

Related

how to set progress bar with rounded starting point in android layout?

I am trying to create a progress bar using default progress bar given in android , I achieved 80% of that required design but i cannot find a code to finish the required design.
this is a required design
given design
i need to bring the rounded part [highlighted in blue ] in my progress bar
finished design
xml code
<ProgressBar
android:id="#+id/ww_progress_bar"
android:visibility="visible"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/circular_shape"
android:progressDrawable="#drawable/circular_progress_bar"
android:textAlignment="center" />
KT class
binding.wwProgressBar.visibility = VISIBLE
binding.wwProgressBar.setProgress(40)
binding.wwProgressBar.max = progressMax
is it possible to bring the required design? can anyone help to finish this design?
you need to use seek bar for it
use custom thumb for it
or
for easy implementation
you can use gihub library
https://github.com/tankery/CircularSeekBar
you should set thumb in your ProgressBar
android:thumb="#drawable/thumb_seekbar"
you can use this link for more information

How to add dyanmic circular borders to imageview like whatsapp [duplicate]

This question already has answers here:
How to represent circle border with multiple colors in android
(3 answers)
Closed 5 years ago.
Please guide me to add dynamic dotted border to image view like whatsapp doing in status screen, Kindly see the below image, I circled the functionality of that I want to achieve,
Whatsapp Status Screen
You can try CircularImageView. You can dynamically change borders. Maybe you'il have to make some arrangements. You can look at example project.
Example.
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="#drawable/image"
app:civ_border_color="#EEEEEE"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_radius="10"
app:civ_shadow_color="#8BC34A"/>

Non custom drawable determinate circular ProgressBar per material guidelines

I am trying to use native Android SDK to create the circular determinate progress bar seen here:
https://material.io/design/components/progress-indicators.html#linear-progress-indicators
I have been reading the docs here:
https://developer.android.com/reference/android/widget/ProgressBar.html
But I can't figure it out. It seems determinate is only able to be used with horizontal progress bar.
I found this stackoverlfow topic here - Android Circular Determinate ProgressBar - but it ussing a custom drawable. Because we can make an indetermiante circular spinner as easily as this:
<ProgressBar
android:id="#+id/determinateBar"
style="#android:style/Widget.ProgressBar.Normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"/>
I was hoping to just add android:progress="1" and android:indeterminate="false" to get the circular determinate spinner we see above but this is not working.

How to make dynamic ring progress bar in android?

I want to create circular progress bar that shows progress of file uploading and downloading as whats app shows. I have seen number or libraries available on github. I do know this question has been asked and I have gone through those as well as mentioned in below link.
https://github.com/lzyzsd/CircleProgress
https://stackoverflow.com/questions/37238185/how-to-create-a-circularprogressbar-like-whatsapp-during-image-uploading
But above links refer to library. Is there any way to create circular progress bar without using any library?
In one of the link over stackoverflow I found below code
ObjectAnimator animation = ObjectAnimator.ofInt (progressBar, "progress", 0, 500);
animation.setDuration (5000);
animation.setInterpolator (new DecelerateInterpolator());
But above code does not set progress dynamically. Means that progress bar works for 5 seconds. It is not mandatory that progress bar should always run for 5 seconds. File size can be vary so is progress bar. My question is how Can I make circular progress bar dynamically without using library?
use this link to dynamically create circular progress bar How to Create a circular progressbar in Android which rotates on it? or How to create circular ProgressBar in android?
You can do that by following way when image view holds from server it hides progress bar until file loads from sever the progress bar rotates.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progress"
android:visibility="visible"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="55dip"
android:minHeight="35dip"
android:minWidth="55dip"
android:maxWidth="10dip"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
</RelativeLayout>
Hope this will help you
layout Xml
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:max="500"
android:progress="0"
android:progressDrawable="#drawable/circular" />
Now create the drawable in your resources with the following shape. Play with the radius (you can use innerRadius instead of innerRadiusRatio) and thickness values.
<shape
android:innerRadiusRatio="2.3"
android:shape="ring"
android:thickness="3.8sp" >
<solid android:color="#color/yourColor" />
1.use this library may be it help you out:
https://github.com/CardinalNow/Android-CircleProgressIndicator
you can also try this one:
Show Progress bar while downloading

Android Circular Progress Bar (Material Design) change color

I need to change the color of the ProgressBar element in a Lollipop (API 21) app.
To be more clear, i mean, for example, to the Youtube mobile app circular progress bar. I need, for example, to make the color of the progress bar red.
I've seen over the internet some examples that use a drawable.xml file but all of theme modify also the animation style of the progress bar. I'd like to maintain the Lollipop/Material Design default animation.
Thanks to all.
Use "src_in" for the indeterminateTintMode and set indeterminateTint to the color you wish to change the progress bar to.
<ProgressBar
android:id="#+id/progressBarSpinner"
android:layout_height="75dp"
android:layout_width="75dp"
android:layout_gravity="center"
android:indeterminateTint="#color/red"
android:indeterminateTintMode="src_in"/>
I just put it in the design view using the following proprieties in Android Studio. Works for me anyway
Design
indeterminateTint = your color
indeterminateTintMode = multiply
Text
<ProgressBar
android:id="#+id/progressBarSpinner"
android:layout_height="75dp"
android:layout_width="75dp"
android:layout_gravity="center"
android:indeterminateTint="#color/accent_material_dark"
android:indeterminateTintMode="multiply"/>

Categories

Resources