I followed an answer on stack overflow to adding a custom rating bar to an android project, here it is: <https://stackoverflow.com/a/32828726/5909396>

Just in case I am posting my code. 

First I created ratingBar.xml in drawable folder:

```
<?xml version="1.0" encoding="UTF-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background"
          android:drawable="@drawable/ratingbar_empty" />
    <item android:id="@android:id/secondaryProgress"
          android:drawable="@drawable/ratingbar_empty" />
    <item android:id="@android:id/progress"
          android:drawable="@drawable/ratingbar_filled" />

```

Then I created ratingbar\_empty.xml and ratingbar\_filled.xml also in drawable folder:

```
<?xml version="1.0" encoding="UTF-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_emptyStar" />

<item android:state_focused="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_emptyStar" />

<item android:state_selected="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_emptyStar" />

<item android:drawable="@drawable/ic_emptyStar" />

```

```
<?xml version="1.0" encoding="UTF-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_fullStar" />

<item android:state_focused="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_fullStar" />

<item android:state_selected="true"
    android:state_window_focused="true"
    android:drawable="@drawable/ic_fullStar" />

<item android:drawable="@drawable/ic_fullStar" />

```

And then I created the custom style in styles.xml

```
<style name="CustomRatingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/ratingbar</item>
    <item name="android:minHeight">50dp</item>
    <item name="android:maxHeight">50dp</item>
</style>

```

And finally I added a ratingBar to layout. The way I structured it is the rating bar is inside a relative layout and there is a textview inside the relative layout as well that is on top of the rating bar (The text view shows if there is no rating);

```
 <RelativeLayout
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.4"
            android:orientation="vertical"
            android:layout_gravity="center">
            <RatingBar
                android:id="@+id/ratingRestaurant"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="@style/CustomRatingBar"
                android:numStars="5"
                android:stepSize="0.1"
                android:isIndicator="true"
                android:max="5"
                android:progress="3"
                android:layout_centerVertical="true"
                android:progressTint="#ffe4b331" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="No rating available"
                android:textColor="@android:color/white"
                android:textSize="11dp"
                android:id="@+id/textViewNoRatingAvailable" />
 </RelativeLayout>

```

When I run the application on the simulator, the stars are really large and are cut-off like below:

[![enter image description here](https://i.stack.imgur.com/ZjkJN.png)](https://i.stack.imgur.com/ZjkJN.png)

There are supposed to be five stars. How can i fix this problem?