Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling SimpleRatingBar #41

Open
willemevenwel opened this issue Jun 6, 2018 · 1 comment
Open

Styling SimpleRatingBar #41

willemevenwel opened this issue Jun 6, 2018 · 1 comment

Comments

@willemevenwel
Copy link

Hi,

Firstly, thanks for a great library, this is so much better than standard RatingBar.

My question is: is it possible to style this SimpleRatingBar in a style resource file?

And if so could you show an example.

Regards,

Willem

@carlosmuvi
Copy link

carlosmuvi commented Jun 8, 2018

@willemevenwel You just have to create a new style. Don't add the app: prefix to the attributes.

   <style name="YourRatingBarStyle">
        <item name="srb_numberOfStars">5</item>
        <item name="srb_starBorderWidth">2.5</item>
        <item name="srb_stepSize">0.5</item>
        <item name="srb_isIndicator">true</item>
        <item name="srb_starCornerRadius">5</item>
        <item name="srb_starSize">15dp</item>
        <item name="srb_starsSeparation">@dimen/your_separating</item>
        <item name="srb_borderColor">@color/your_color</item>
        <item name="srb_fillColor">@color/your_color</item>
    </style>

And then, in your layout:

        <com.iarcuschin.simpleratingbar.SimpleRatingBar
            android:id="@+id/rating"
            style="@style/YourRatingBarStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants