Skip to content

Star padding problem at runtime #84

Description

@AminEsmaeily

I have a layout view like this:

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:background="@drawable/btn1"
        android:paddingLeft="5dp"
        android:paddingTop="35dp"
        android:paddingRight="5dp"
        android:paddingBottom="5dp">

        <com.willy.ratingbar.ScaleRatingBar
            android:id="@+id/srbOveralRating"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layoutDirection="ltr"
            app:srb_numStars="5"
            app:srb_minimumStars="1"
            app:srb_starWidth="20dp"
            app:srb_starHeight="20dp"
            app:srb_starPadding="5dp"
            app:srb_stepSize="0.5"
            app:srb_isIndicator="true"
            app:srb_clickable="false"
            app:srb_scrollable="true"
            app:srb_clearRatingEnabled="true"
            app:srb_drawableEmpty="@drawable/ic_star_empty"
            app:srb_drawableFilled="@drawable/ic_star_full"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="20dp"/>

        <com.willy.ratingbar.ScaleRatingBar
            android:id="@+id/srbUserRate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layoutDirection="ltr"
            app:srb_numStars="5"
            app:srb_minimumStars="1"
            app:srb_starWidth="40dp"
            app:srb_starHeight="40dp"
            app:srb_starPadding="5dp"
            app:srb_stepSize="1"
            app:srb_isIndicator="false"
            app:srb_clickable="true"
            app:srb_scrollable="true"
            app:srb_clearRatingEnabled="true"
            app:srb_drawableEmpty="@drawable/ic_star_empty"
            app:srb_drawableFilled="@drawable/ic_star_full"
            android:layout_below="@id/srbOveralRating"
            android:layout_marginTop="10dp"/>
    </RelativeLayout>

At design-time it shows perfectly:
Capture

but at runtime, the stars arrange without considering the starPadding property and they stretch to fill the parent:
Screenshot_1585210330

And the second issue is about displaying the half star when the main layout direction has been set to RTL, but as you can see in code, the control's layoutDirection property has set to LTR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions