Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带阴影/辉光的Android RatingBar星星_Android_Shadow_Ratingbar - Fatal编程技术网

带阴影/辉光的Android RatingBar星星

带阴影/辉光的Android RatingBar星星,android,shadow,ratingbar,Android,Shadow,Ratingbar,我想在比率栏中为星星添加阴影。我还想使用半星,所以我不能直接在星图上添加阴影。这是否可能实现,或者我必须创建一个自定义分级栏 我使用以下可绘制图形使非填充星形透明: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/backgro

我想在比率栏中为星星添加阴影。我还想使用半星,所以我不能直接在星图上添加阴影。这是否可能实现,或者我必须创建一个自定义分级栏

我使用以下可绘制图形使非填充星形透明:

<?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>

尝试在原来的评级条后面使用另一个评级条,并将其样式设置为阴影。然后将后面的评级栏与顶部的评级栏同步

<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>


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

我希望能够使用半星
android:stepSize=“0.5”
,所以我很确定这不会起作用。我肯定它会起作用,或者我没有正确理解你的问题。我现在明白你的解决方案了。不幸的是,我也希望阴影上有一些模糊。我希望与
android:shadowRadius
对文本的效果相同。它会产生模糊/柔和的阴影。您的解决方案将在阴影分级栏的半星上创建一个锐利的边缘,这使得软阴影不可能出现。为背景分级星提供自定义样式并为其设置一些软图片怎么样???