I have a custom style for my rating bar. I want to change the star image from the code (deending on some user operation).
Is there anyway to change the style? the image?
I may try to re-inflate the ratingbar but I am not sure it will be OK, or if it is the correct way.
Related
I know that Rating bar is not in the list of remoteView compatibile classes, but I saw some widget with a rating bar working fine, how is it possible?
Should I simulate it with some star buttons?
Thanks
I solved in a bad way. I put on the widget a button (with a star drawable) for each star in need in the rating bar, then for each button star I give different OnClickListeners that corresponds to the star number. For example, the first star button has the OnclickLister 'firstStarPressed'. In this method the button star drawable is updated to a filled star drawable.
I got rid of ugly, but it works
Does any one knows any way to change background of a progress bar to sth like this image?
As you can see there is a color plate in background which starts from green to red and there is an indicator which shows a title. I have no idea how to make it or if there is some keywords to search about it or even some liberaries.
thanks very much
P.S: It seems this is what I need.
https://github.com/ademar111190/android-phased-seek-bar
You can use seekbar for the indicator with thumb image changes and background as progress drawable in your xml.
Search for customizing seekbar and see whatever suits the best for your requirement.
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.
How do I adjust Spinner dialog style?
All I want to do is to change the background, either to drawable or a color.
If you want change the spinner's popup background, you can use : setPopupBackgroundResource()
For change background of the spinner (not the popup), this tutorial are good -> link
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.