Android RatingBar shows less stars - android

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.

Related

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

ProgressBar in ActionBar padding is wrong

In my application I request a determinate progress bar using:
this.requestWindowFeature(Window.FEATURE_PROGRESS);
It works well but the bar does not span to the edges of the screen (see below picture). What could I do to fix this?
I compile against API v22 and I am not using appcompat.
I do not know for sure if this will resolve it or if it does, it is the perfect way to do it. I had a similar problem and i had used a negative layout_margin like below
android:layout_marginLeft="-22dp"
android:layout_marginRight="-22dp"
for the progress bar
You could try and see if this helps;-)

Android - Action Bar Style

I want to show Action Bar like below.
I have already used this library clickhere
But it takes only two icons on Action Bar. If I add four items, then last two are shown me like menu. I want all in Action bar same as image above.
Is it possible? if yes, then HOW? Can I change Action Bar color or its default style available in Device?
Thanks in Advance.
I recommend you use this:
http://jgilfelt.github.com/android-actionbarstylegenerator/
to style your ActionBar.
If you want all the 4 icons to be there, just add this attribute to all the menu items:
android:showAsAction="always"
hello try this library
it sure help you And you may have to add you own logic to handle this in below 2.3 Android OS and above 3.0 Android OS.
there is many demo sample available like below :
There is no way you can be sure of the number of icons displayed in the action bar. There is a large varierty of Android devices out there and they all have different screen sizes. That's why you have to prioritize the actions available in a menu : the most important will be displayed as actions in the action bars and the others will be displayed in the "menu" : the action overflow.
You should think of actions in a functional way, not a graphical way.
With ref to Image that you attached you should decide which design pattern you want to use in your application, there are many UI patterns available for mobiles, tablets. The image you attached looks like Side Navigation UI pattern. It's better you decide which UI pattern perfect for your app.. then start implementing it with custom action bar libs (if you want action bar in less than Android 3.0 ver) or any other.

Having trouble with rating bar

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.

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.

Categories

Resources