2014-03-31 56 views
1

我想给RatingBar中的明星添加阴影。我也想用半个星星,所以我不能直接在星形图像上添加阴影。这是可能实现或将我必须创建一个自定义RatingBar?Android RatingBar明星与阴影/辉光

我做非填充明星透明使用以下绘制:

<?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="@android:color/transparent" /> 
    <item android:id="@android:id/secondaryProgress" 
     android:drawable="@android:color/transparent" /> 
    <item android:id="@android:id/progress" 
     android:drawable="@drawable/star" /> 
</layer-list> 

回答

1

尝试使用背后原来另一家评级酒吧并使其风格的影子。然后将后面的评分栏与顶部的评分栏同步。

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:layout_alignLeft="@+id/textView1" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="22dp" > 

<RatingBar 
    android:id="@+id/ratingBar2" 
    android:layout_width="wrap_content" 
    android:layout_height="40dp" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="0dp" 
    android:layout_marginLeft="5dp" 
    android:stepSize="0.5" 
    android:focusable="false" /> 

<RatingBar 
    android:id="@+id/ratingBar1" 
    android:layout_width="wrap_content" 
    android:layout_height="40dp" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="10dp" 
    android:stepSize="0.5" 
    /> 

</RelativeLayout> 

然后同步评级栏。随着任何一个改变,另一个也会改变。

+0

我希望能够使用半星android'stepSize =“0.5”',所以我很确定这是行不通的。 –

+1

我相信它会起作用,或者我不能正确理解你的问题。 –

+0

我现在了解您的解决方案。不幸的是,我也想要一些模糊的影子。 –