material-components / material-components/material-components-android

[RatingBar] Request: offer a new class instead of what we have of RatingBar, being able to have width and/or height boundaries for it, to let it scale accordingly to them

Open
#4,258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request New component
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Yes. Currently all we can do is either use a large one of a small one by styles:

```
style="?android:attr/ratingBarStyleSmall"

style="?android:attr/ratingBarStyle"
```
But if you want it to be smaller/larger, you can't do it using normal ways like on other Views.

I think it's time for this to be more flexible and consistent with the rest of the Views.

**Describe the solution you'd like**
Be able to make it auto-scale according to the width and/or height that we enforce to it, just like any other View, such as ImageView, etc...
Not to mention it ruins the View itself (if you make it smaller by half, it reaches a point it shows 3 stars instead of 5, for example).

**Describe alternatives you've considered**
We can use "scaleX" and "scaleY", but those aren't recommended for this, and you lose the point of using real dimensions and constraints this way.

**Additional context**
Can be useful for native ads, for example:
https://support.google.com/admob/answer/6329638#zippy=%2Csee-examples-of-each-standard-native-ad-format:~:text=video%20content%20ad-,Native%20app%20install%20ad,-Native%20video%20app

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the existing RatingBar but no implementation files or tests. Start by locating its implementation and current sizing tests, then define the supported width and height behavior and verify that constrained instances preserve the intended star display.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.