RatingBar stars show a strange effect

I am using rating to show the rating of a movie in my application. My layout file was tagged with a rating bar like this:

               <RatingBar
                android:id="@+id/RatingBar"
                style="@style/MicRatingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="2dp"
                android:layout_toRightOf="@+id/movie_img"
                android:isIndicator="true"
                android:numStars="5"
                android:rating="3.0"
                android:stepSize="1"
                android:textColor="@drawable/button_text" />

      

For the styling part, I assigned it minHeight and maxHeight 9dp, which reduce the odd ones, but haven't completely disappeared. My rating bar looks like this. what are these lines. please help. thanks in advance.

enter image description here

This part of the style is as follows:

<style name="MicRatingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/custom_rating_selector</item>
    <item name="android:minHeight">9dip</item>
    <item name="android:maxHeight">9dip</item> 
</style>

      

+3


source to share


1 answer


Please see minHeight for View class and maxHeight ProgressBar (there is no maxHeight attribute in View class). When you install android:layout_height="wrap_content"

, it tries to measure itself to the minimum height that you provided. You can get a broader idea if you see onMeasure(...)

AbsSeekBar (RatingBar extends AbsSeekBar)



0


source







All Articles