Search code examples
android-widgetandroidreview

Review UI Widget from Google Play


I need to implement a Reviews widget in my application, similar to that seen in Google Play. Image Below:

enter image description here

Are there any components our there that make it easier to do this? It would save time & trouble of implementing my own version.

Thanks


Solution

  • I used a custom layout for this as cmota recommended.

    The labels for the stars are a series of TextViews within a Relative layout

    The rating bars are Imageviews in a Linearlayouts.

    Code snippet:

    ImageView ratingOne = (ImageView) ratingsView.findViewById(R.id.ratingOne);

          <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="15dp"
            android:background="@android:color/white"
            >
    
            <ImageView
                android:id="@+id/ratings_length_one"
                android:layout_width="wrap_content"
                android:layout_height="15dp"
                android:background="@color/orange" />
    
          </LinearLayout>
    

    Each imageview has a fixed height : for example i use 15dp above

    The width of the imageview is the my rating count

    Then i change the layoutParams for each imageView according to the values

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(myRatingCount, ratingOne.getHeight());

    ratingOne.setLayoutParams(layoutParams);