gpt4 book ai didi

带有阴影/发光的 Android RatingBar 星星

转载 作者:行者123 更新时间:2023-11-30 02:59:28 28 4
gpt4 key购买 nike

我想给 RatingBar 中的星星添加阴影。我也想用半星,所以我不能直接在星图上添加阴影。这有可能实现还是我必须创建自定义 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>

最佳答案

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

<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 RatingBar 星星,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22763118/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com