custom holo style progress bar - android

I want to create custom progress bar in android which is as follows
But i don't want to use any external library like actionbarsherlock for that so how can i create it using xml layouts and all. i am using android 2.3.3 version.
More over i tried to copy some styles , drawable images from HoloEveryWhere from this link
but i am not getting expected result. please look below. its a constantly moving bar.
i used following code
<ProgressBar
style="#style/ProgressBarHolo.Horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:progress="25" />
and in style
<item name="android:progressDrawable">#drawable/progress_horizontal_holo_dark</item>
<item name="android:indeterminateDrawable">#drawable/progress_indeterminate_horizontal_holo</item>

You need to include the definitions of "progress_horizontal_holo_dark" and "progress_indeterminate_horizontal_holo". Here are the files: https://github.com/ChristopheVersieux/HoloEverywhere/blob/master/HoloEverywhereLib/res/drawable/progress_horizontal_holo_dark.xml and https://github.com/ChristopheVersieux/HoloEverywhere/blob/master/HoloEverywhereLib/res/drawable/progress_indeterminate_horizontal_holo.xml
Don't forget to copy the assets mentioned in above two files too.
Then you will see the progress bar shown in your second image.

What you want here is not a progressBar but a seekBar. The drawables you copied are the drawables of the holo progress bar, but the one you see is an indeterminate progressBar. That's why it's a constantly moving bar.
Just setIndeterminate="false" and set the progress, max etc and you will have a holo determinate progressBar.
But the first image you posted is a seek bar =) => link HERE

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

Android ProgressBar color not displaying correctly on tablet

I am trying to make an app in Android Studio. In the app I have a progress bar. On the phone the color is displayed correctly like this:
https://ibb.co/ChK208w (Sorry, SO didn't allow me to post images)
And on the tablet it is displayed like this:
https://ibb.co/rpMKL0h
Here is my progress bar code for color:
<ProgressBar
android:id="#+id/progressBar"
style="#android:style/Widget.ProgressBar.Horizontal"
............
android:progressBackgroundTint="#FAFAFA"
android:progressTint="#D8EDD5" />
Any ideas what could cause the tablet version of the app to display the progress bar like that?
Use the prefix app: while using tint attributes like
app:progressBackgroundTint="#FAFAFA"
app:progressTint="#D8EDD5"

Android Rating bar displays only one star

I have created custom style for RatingBar and when I apply my style to rating bar, it shows only one star, and in properties of RatingBar, I've define the size of the start which 5 as well, but on run time it displays only one star.
Note:I am using ActionbarActivity, in that I am displaying RatingBar, but when I use only Activity class, it displays 5 star and the theme is also applied on that.
So Please help me out from this issue.
check if you are using Vector Drawable which is causing this issue. So to work with it try to replace Vector Drawable with png image in the drawable folder and see the magic it work.
you are using Vector Drawable with layer-list so your Vector Drawable image is fit to the whole layout try to replace it with png which will solve your problem.
Try this in XML:
<RatingBar
android:id="#+id/rating_bar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:rating="3.5" />

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"/>

Is there a black progress bar to be visible on a white background?

The default progress wheel on Android doesn't display well when the background is white, it's barely visible. How can I fix this?
If you look at the built in styles.xml file and poke around the platform's built in drawables, it turns out the solution is pretty simple. You can use the "style" attribute to use the inverse progress bar:
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="40dip"
android:layout_height="40dip"
android:padding="6dp"
android:indeterminate="true"
style="?android:attr/progressBarStyleInverse"
/>
Be sure if you have a white background to set the theme in your manifest to #android:style/Theme.Light. This provides resources for all of the widgets to go with a light background.
I dont think there is way to fix this since the progressbar is sdk dependant. orange on 1.5, white on 1.6 etc... green on some devices, etc etc...
Your would have to implement/override it with your own graphics to change it.
I had the similar problem, i solved it by setting a constrasting background on the progressbar. (50% transparent black)
Here is similar issue using the horisontal progressbar implementing a custom color:
How to change progress bar's progress color in Android
The circular is abit diffrent i think, but probably not impossible ;-)

Categories

Resources