2014-02-25 23 views
2

我需要在我的应用程序中实施评论小部件,与Google Play中的类似。图像下方:从Google Play中查看UI小部件

enter image description here

是否有任何部件我们那里,更容易做到这一点?这会节省执行我自己版本的时间&的麻烦。

谢谢

+0

海..你有没有找到解决方案呢? – Vijay

+0

@Vijay嗨,是的,我做了,但我不得不去与自定义布局。 Linearlayout和Relativelayouts – AndroidEnthusiast

+0

你是如何计算评分的?你可以发布计算? – Vijay

回答

0

我为此推荐使用cmota的自定义布局。

星星的标记是一个相对布局

该评级酒吧Imageviews在Linearlayouts中的一系列TextViews的。

代码片断:

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> 

每个imageview的具有固定的高度:例如我使用15dp以上

所述的ImageView的宽度是我的评级计数

然后我根据值改变的LayoutParams每个ImageView的

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

ratingOne.setLayoutParams(layoutParams);

3

我将创建一个自定义布局。

一个用于星号信息的TextField,一个显示星号数量的进度条和另一个显示评级数量的TextField。一切都在LinearLayout(orientation = horizo​​ntal)上进行正确对齐。