Having trouble with rating bar - android

I am playing with rating bar. I follow One good tutorial for customizing rating bar.
I am Facing some problem:
This tutorial use one image for rating bar but i don't want to use
any image for rating bar. i need to use android Rating bar widget.
When i use Android Rating widget it show too large or too small(when i use style="?android:attr/ratingBarStyleSmall">) with
having more than 10 star whether we set android:numStars="5" or not.
Ok. Suppose i use any image for that but when i set rating = 2.5 then
image still not change i use this method ratingBar.setRating(Float.parseFloat("2.0"));.
Here i use image for this rating bar
my code is same as which given above link.
Can you give me some reference by using i can use Rating bar widget in small shape with only 5 star?
I don't want to use any image i want to use only android rating widget.
I stuck here from last 5 hours.
Any help appreciated.

Related

Android RatingBar shows less stars

I am trying to show a rating bar in a ListView.
No matter what I tried:
viewHolder.viewOnlyQuickRatingBar.setNumStars(5);
or:
android:numStars="5"
or both of the above I always get the same result.
In Android 5.0 I get a 5-star rating bar and in Android 4.1.2 I get 4-star rating bar.
The weird is when I try to show the rating bar (using the, above, xml code only) in Activity and not in a ListView everything is working just fine.
How can I get a 5-star rating bar under any circumstances?
From experience, adding :
style="?android:attr/ratingBarStyleSmall"
in your xml can help if your view has not enough place to draw 5 stars.

Progress Bar lollipop style

I need to display a progress like the image displayed below, but without arrow in that.How to do it ? Its not given in design specs but have seen some apps implementing that, is it possible ?
Design Specs
For such circular process bar in older SDK level, you can use this custom view ,
MaterialLoadingProgressBar

Creating Dynamically changing icons in status bar and status notifications(ongoing), Android

I want to create dynamically changing/animating icons which will show up in statusbar and notifications in android.
Below are some examples that can clarify what I want :
In above example 2nd icon in left side of status bar changes with time ! I want to add similar functionality in my app but I am not able to figure out how to do that.
Also please tell me what should be the dimensions of the image icon that I should make ?

Rating bar showing only half stars instead of full stars

I'm working on an app that needs to create a non editable small style rating bar with 4 stars dynamically.
When I call setRating(4) it shows 4 stars without any problem.
But when I call setRating(3) it shows 3 and half stars.
setRating(2) shows 2 stars correctly,
but setrating(1) shows 1 and half stars.
When I use a normal rating bar in another activity it works fine, but when I use the small style non editable rating bar it doesn't work properly.
Does this have anything to do with the api level or small style non editable rating bar?
Initialization is done like this:
RatingBar ioRatingBar = new RatingBar(this,null,android.R.attr.ratingBarStyleSmall);
ioRatingBar.setNumStars(4);
ioRatingBar.setRating(3);
You need to set the step size of the RatingBar like this
ratingBar.setStepSize(1.0);
and also try to define the max rating as:
ratingBar.setMax(4);
If exist padding, remove. I suggest replace with margin.

How to use Rating bar?

i would like to save the state of rating bar rating stars? How would i go about doing this?
and also how would i go about getting the number of stars the user has selected? To display in a textView?
Thanks
From developer.android.com :
http://developer.android.com/resources/tutorials/views/hello-formstuff.html#RatingBar
Other Example Here..
http://android-er.blogspot.com/2010/02/ratingbar.html
If you want to customize RatingBar eg. Displaying other image than default Star
refer How to create Custom Ratings bar in Android
This example shows Toast message when user selects Ratings.
& Obviously you will have to customize it according to your needs (as you told you want to display it in TextView).
You can define a TextView in xml file & set its text property when Rating has changed.

Categories

Resources