Can I set the rating bar size to match constraint? - android

I am finding "solutions" suggesting using the small rating bar style, or to just change the size of the stars with a custom style, but I don't want it to be fixed. I just want the 5 stars bar to match the constraints?

You can use flexible RatingBar
FlexibleRatingBar

Related

Inconsistent paddings on the Toolbar

It seems that icons and text menu items on a Toolbar take different paddings
Google doesn't seem to implement their design specification. I think icons take 12dp but text menu items take just 8dp. What's the right way to give text menu items additional padding so that they match icons' paddings?
What is the canonical approach to handling this inconsistency?
Thanks

Separator between icon and text action bar

I need to display a separator between the logo and text on the action bar. Is it possible to set this via styles?
P.S: My minSdk is 14, so I use system Holo elements.
I am not sure you can achieve this with the style. Generally the dividers are made for the MenuItem. A simplest way to do it, it's to add manually your divider inside your icon app and keep the width unchanged.

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.

Android how to keep Sherlock ActionBar Menu font size constant even if we change device font size

In my application, I have some textual menu on action bar. For action bar I use Sherlock support library. Also as per this answer I have changed font size to some fixed size say 17dp to those menus. But whenever I change system font size, the font size of menu text also increases and that goes beyond action bar's height. Is there any way I can keep the menu font size fixed irrespective of the system font size?
Finally I ended up in removing menus and adding them in my custom view xml for action bar.

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