gpt4 book ai didi

android - 如何在android中制作实时更新的评分栏?

转载 作者:行者123 更新时间:2023-11-29 16:20:20 25 4
gpt4 key购买 nike

Android 文档 said

public abstract void onRatingChanged (RatingBar ratingBar, float rating, boolean fromUser)

Since: API Level 1 Notification that the rating has changed. Clients can use the fromUser parameter to distinguish user-initiated changes from those that occurred programmatically. This will not be called continuously while the user is dragging, only when the user finalizes a rating by lifting the touch.

我如何构建一个可以在用户拖动时更新的评分栏?

我还发现 ratingBar 不是很可定制。更改图像的方法是一些 hack 提到的 here有没有开源的?谢谢

最佳答案

这对我有用,我认为这是最简单的方法:在 ratingBar 上设置一个 onTouchListener,这样在任何事件中,向下、移动和向上都可以广播评级(ratingBar.getRating() 将为您提供实时值)到您想要用它做的任何事情。

关于android - 如何在android中制作实时更新的评分栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7407363/

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