Search code examples
androidwidgetrating

Rating is not correctly displaying in HTC


I am having rating widget with style, It is displayed good in some devices but having the problem with some devices like with HTC My xml is :

<LinearLayout android:layout_width="fill_parent" 
            android:id="@+id/linearLayout3" 
            android:gravity="left|center_vertical|center_horizontal" 
            android:orientation="horizontal"
            android:layout_height="wrap_content">
        <RatingBar android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:numStars="5" android:stepSize="0.1"
            android:layout_weight="0.1"
            style="?android:attr/ratingBarStyleIndicator" 
            android:id="@+id/ratingbar_incident"                
            android:isIndicator="false"/>

        <TextView android:id="@+id/textViewVote" 
            android:layout_height="wrap_content" 
            android:layout_marginLeft="1dip" 
            android:textColor="@color/black" 
            android:text="(0 votes)" android:layout_width="wrap_content"/>
        </LinearLayout>

.enter image description here

How to resolve this issue?


Solution

  • First you should look out for style="?android:attr/ratingBarStyleIndicator"

    The smaller RatingBar style ( ratingBarStyleSmall) and the larger indicator-only style (ratingBarStyleIndicator) do not support user interaction and should only be used as indicators.

    Also :

    When using a RatingBar that supports user interaction, placing widgets to theleft or right of the RatingBar is discouraged.``

    Reference: RatingBar - documentation