FlexibleRatingBar
Enhanced version of RatingBar with support for different polygons, resizing, and coloration
Install / Use
/learn @Amagi82/FlexibleRatingBarREADME
FlexibleRatingBar
FlexibleRatingBar is an enhanced version of Android's default RatingBar.
The default Android RatingBar scales very poorly, and requires custom drawables to do pretty much anything besides the default. FlexibleRatingBar creates polygons with however many vertices you want, and scales them to fit the the allotted space, so it scales properly and predictably. It also gives you a lot of flexibility with regards to color.

Including in your Project
FlexibleRatingBar is compatible all the way back to API 4. To get started, add the following dependency to your build.gradle.
(currently getting this set up with maven/jcenter. will update when available)
Usage
<amagi82.flexibleratingbar.FlexibleRatingBar
android:id="@+id/flexibleRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="6"
android:rating="1.5"
android:stepSize="0.5"
app:colorFillOff="@android:color/transparent"
app:colorFillOn="@color/tealA400"
app:colorFillPressedOff="@android:color/transparent"
app:colorFillPressedOn="@color/tealA200"
app:colorOutlineOff="@color/teal800"
app:colorOutlineOn="@color/teal900"
app:colorOutlinePressed="@color/teal500"
app:polygonVertices="7"
app:polygonRotation="0"
app:strokeWidth="5dp"/>
Add <amagi82.flexibleratingbar.FlexibleRatingBar/> to your layout, and use the same as you would any other widget.
layout_width and layout_height will scale the rating bar appropriately.
In addition, you can alter any of the above settings in xml, or do it in code.
The colors should be self-explanitory. polygonVertices is the number of points on your star.
You can go down to 2, which creates a diamond, or enter 0 and get circles.
By default, polygons are drawn with one point centered at the top. polygonRotation rotates it by int degrees.
strokeWidth is the thickness of the outline around the star.
In code, you can change any of the above with myRatingBar.setColorFillOff(Color.argb(55,145,122,235)) and so on.
In addition, you can call setInteriorAngleModifier, which adjusts the interior angle of the polygons.
Default is 2.2, and I recommend keeping it between 1(round) and 3(very pointy).
Developed By
Jim Pekarek - amagi82@gmail.com
<a href="https://plus.google.com/u/0/+JimPekarek"> <img alt="Follow me on Google+" src="http://icons.iconarchive.com/icons/danleech/simple/64/google-plus-icon.png"/> </a> <a href="https://www.linkedin.com/pub/james-pekarek/7b/833/bb0"> <img alt="Follow me on LinkedIn" src="http://icons.iconarchive.com/icons/danleech/simple/64/linkedin-icon.png"/>License
Copyright (C) 2015 James Pekarek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Skills
openhue
351.4kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
351.4kElevenLabs text-to-speech with mac-style say UX.
weather
351.4kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.6kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
