- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
.
我创建了一个自定义评级栏。我设置了 5 个自定义星图,但它只显示了一个。而不是可变数量的评级可绘制对象,我只看到一个,无论设置的星星数量如何。任何帮助将不胜感激。
xml.code :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<RatingBar
android:id="@+id/ratingbar_default"
style="@style/RatingBar"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginBottom="20dp" />
<TextView
android:id="@+id/textView"
android:layout_width="276dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="show state up checkbox"
android:textColor="#CC00CC"
android:textSize="20dp" />
Java 代码:
Activity RatingBarActivity
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating);
final TextView text = (TextView) findViewById(R.id.textView);
final RatingBar ratingBar_default = (RatingBar) findViewById(R.id.ratingbar_default);
ratingBar_default.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener()
{
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser)
{
// TODO Auto-generated method stub
text.setText("Rating: " + String.valueOf(rating));
}
});
<?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="@drawable/star_ratingbar_full_empty" />
<item
android:id="@android:id/secondaryProgress"
android:drawable="@drawable/star_ratingbar_full_empty" />
<item
android:id="@android:id/progress"
android:drawable="@drawable/star_ratingbar_full_filled" />
</layer-list>
res/drawable/star_ratingbar_full_empty.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/star2" />
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/star2" />
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/star2" />
<item android:drawable="@drawable/star2" />
</selector>
res/drawabstar_ratingbar_full_filled.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- This is the rating bar drawable that is used to
show a unfilled cookie. -->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/star3" />
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/star1" />
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/star1" />
<item android:drawable="@drawable/star1" />
</selector>
styles.xml 文件:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
<style name="RatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/star_rating_bar_full</item>
<item name="android:minHeight">48dip</item>
<item name="android:maxHeight">48dip</item>
</style>
</resources>
最佳答案
在我的案例中,问题出在图层列表中的 SVG 可绘制对象中。当我将它们更改为 PNG 时,它开始正常工作
关于android - 自定义评级栏仅显示一颗星,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30144452/
我正在使用 MySQL 和 PHP 为 Flash 游戏构建数据层。检索关卡列表非常简单,但我在尝试获取关卡的平均评分及其指针信息时遇到了障碍。这是一个示例数据集: 级别表: level_id | l
阅读 schema.org 之后我写了一个小的“丰富代码片段”或者它所谓的什么。我们今天被谷歌找到,但没有显示星级和评级。也许有人对此有经验并且知道事情是如何完成的?它仅取决于微数据还是取决于 中的
有没有一种方法(或 API)可以使远程 SMF 站点排队以获取特定时间范围内的热门/热门主题,比如过去 24 小时?如果没有,关于我如何跟踪它有什么建议吗? 最佳答案 不确定这是否可行,但我知道 SM
有谁知道如何使用 Foursquare API 获取 field 的分数/评级(例如 9.0/10)? 我正在通过无用户访问进行连接。 https://developer.foursquare.com
我正在使用 Sonar 来分析一组相关的项目。 我正在使用 SQALE 评级来证明重构的必要性 我的问题是 SQALE 到技术债务比率映射背后的逻辑是什么? 为什么 SQALE A 评级是技术债务,范
我有一份 FIFA 19 两名球员之间的比赛列表,我希望根据所参加的比赛使用该数据更新我在这两名球员之间的 ELO 评分。我正在尝试使用此数据不断更新最初从 1000 开始的 ELO 评级。 我尝
我无法显示评级元素。它根本就没有出现。所有其他事情都很好 我已经正确地链接了这些: 语义用户界面 CSS ( http://semantic-ui.com/dist/semantic.min.css
我正在开发一个 Java 应用程序,其中涉及使用 Foursquare 来搜索 field 。该应用程序预计也会对场馆进行评级。除了场馆的收视率之外,我已经做了所有我需要做的事情。我阅读了利用 fou
由于我公司的一位客户要求标记图像上的 alt 属性,我遇到了 google maps API 的问题。 我在谷歌官方文档中找不到任何内容(即:https://developers.google.com
有人可以给我一个 onRate() 的例子吗? Semantic UI 中评级小部件的回调函数 ( http://semantic-ui.com/modules/rating.html#/settin
我有四个主表- 1.user(user_id, name,...) 2. post(post_id, description, ...) 3.comment(comment_id,user_id,co
我已登录并获取身份验证 token ,但当我单击“赞”按钮时,YouTube 评级不起作用。我还需要做什么才能让它发挥作用?如果我在网络浏览器中使用该网址,它会要求授权并执行,然后它就可以工作。但从应
我正在使用我在网上找到的一些评级系统 CSS。目前我能够让它工作,但是当显示多个评级时会出现问题。 只有最后一个分级类有效。 .rate { float: left; pointer-even
我安装了一个应用程序 django- ratings。我想要syncdb,但这是我的错误: djangoratings.vote: 'user' defines a relation with the
每个人都喜欢在他们的网站上显示 Digg/Tweet/Like 徽章,而 Disqus Comment System开始接管。 (来源:disqus.com) (来源:digg.com) 从开发人员的
我有一个 Bootstrap Rating 组件,我必须使用 on-leave 方法来调用我的 javascript 函数。除了 IE 之外,所有其他浏览器也在单击事件上执行 on-leave 函数。
我正在用 Rating Bootstrap 做一个 MVC 应用程序。 我也定义了这个...为了知道点击了多少开始。 $(document).ready(function () {
我想按人口统计(性别、年龄组)收集 IMDb 评级详细信息。 当我尝试在 imdbpy 中使用 get_movie_vote_details 模块时,我的输出为空。这是我的代码: import im
我正在尝试使用 PHP 和 SoapClient 来利用 UPS Ratings 网络服务。我找到了一个名为 WSDLInterpreter 的好工具来创建用于创建服务请求的起点库,但无论我尝试什么,
我正在尝试向现有表格添加“评级”系统(即 1 星、2 星或差、一般、好、优秀等)。有谁知道在 .Net 或免费的第 3 方控件中通过良好的 UX 实现美观的方法? 谢谢 最佳答案 检查 ASP.NET
我是一名优秀的程序员,十分优秀!