ratingbar

How to allow full values (integers) only in ratingbars?

核能气质少年 提交于 2019-12-01 15:35:42
My client wants a ratingbar in one of the activities, but he doesn't want it to allow half-stars (aka float) values. I've been google-ing around but found nothing about it. Does anybody know if it is possible to force the ratingbar to not allow half-stars? Thanks in advance. Should be able to use setStepSize() and use a 1.0 to allow increments of 1 star instead of 0.5 for half stars Here is the docs on it. ElYeante It can be set in the xml too, with android:stepSize="1" Try to set the Step size like this ratingBar.setStepSize(1.0); 来源: https://stackoverflow.com/questions/14218029/how-to-allow

How to allow full values (integers) only in ratingbars?

最后都变了- 提交于 2019-12-01 13:40:58
问题 My client wants a ratingbar in one of the activities, but he doesn't want it to allow half-stars (aka float) values. I've been google-ing around but found nothing about it. Does anybody know if it is possible to force the ratingbar to not allow half-stars? Thanks in advance. 回答1: Should be able to use setStepSize() and use a 1.0 to allow increments of 1 star instead of 0.5 for half stars Here is the docs on it. 回答2: It can be set in the xml too, with android:stepSize="1" 回答3: Try to set the

ShapeDrawable as progressDrawable for RatingBar in Android?

时光怂恿深爱的人放手 提交于 2019-12-01 00:05:34
It seems I cannot set ShapeDrawable as progressDrawable for Ratingbar. I tried the following but failed: <RatingBar android:id="@+id/ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:numStars="5" android:stepSize="1.0" android:rating="3.0" style="@style/myRatingBar" /> myRatingbar style: <style name="myRatingBar" parent="@android:style/Widget.RatingBar"> <item name="android:progressDrawable">@drawable/ratingbar_full</item> <item name="android:indeterminateDrawable">@drawable/ratingbar_full</item> <item name=

When I use custom stars for Android RatingBar, always show half star for decimal values below 0.5

寵の児 提交于 2019-11-30 12:32:20
I've looked up a number of posts (e.g. Android RatingBar change star colors , Change the color of the stars in the rating bar where the rating bar is created dynamically in android , How can I set the star color of the ratingbar? ) in order to change the colours of the stars in the RatingBar. I followed the posts and was able to change the stars for the custom RatingBar, but in doing this I was no longer able to set the value to be a decimal lower than a half (e.g. 0.2). It would always show up as the half (e.g. 0.5). When I set the value to be above the half (e.g. 0.7) it displays perfectly.

RatingBar custom Vector Drawables superimposing

断了今生、忘了曾经 提交于 2019-11-30 08:06:44
RatingBar in android is frustrating. I've followed https://stackoverflow.com/a/13107765 to implement a custom ratingbar with my own drawables, but all the stars just superimpose each other, so that only a single star is finally displayed. I can't, for the life of me, figure out why. EDIT: PNG drawables seem to work fine, however SVGs used as vector drawables are causing this problem Here is a temp fix until they look into it in the support lib ( I've also put it in gist https://gist.github.com/harrane/815e8a94d7ca75d964714228af69c60c ) public class RatingBarVectorFix extends RatingBar {

Android RatingBar doesn't accept float values

时光总嘲笑我的痴心妄想 提交于 2019-11-29 15:29:34
I have an android rating bar in my app, and it only displays int ratings. For example: float ratingValue = 1.5f; myRatingBar.setRating(ratingValue); and the ratingbar displays 2 full stars. How can I make it display one and a half stars, or two and a half? try to use float ratingValue = 1.5f; myRatingBar.setRating(ratingValue); // to set rating value myRatingBar.setStepSize(ratingValue);// to show to stars public void setStepSize (float stepSize) Sets the step size (granularity) of this rating bar. Parameters stepSize The step size of this rating bar. For example, if half-star granularity is

RatingBar custom Vector Drawables superimposing

社会主义新天地 提交于 2019-11-29 11:00:08
问题 RatingBar in android is frustrating. I've followed https://stackoverflow.com/a/13107765 to implement a custom ratingbar with my own drawables, but all the stars just superimpose each other, so that only a single star is finally displayed. I can't, for the life of me, figure out why. EDIT: PNG drawables seem to work fine, however SVGs used as vector drawables are causing this problem 回答1: Here is a temp fix until they look into it in the support lib ( I've also put it in gist https://gist

How can I set the color of android rating bar's stroke? (Not the color of the stars but the BORDER)

余生颓废 提交于 2019-11-28 21:09:07
I am an android beginner and I want to make my custom ratingBar. Disclaimer: it's not a duplicate. because all the posts I have read asks about how to change colors of the star and how to remove the stroke. That is NOT what I want. I want to have the stroke and to be able to change the color of the border. With a transparent and yellow stroke while empty, and yellow background and stroke for half and filled. I do NOT want to use pngs. I have my own already but they are too small. I just dont want to ask the designer to make new ones if I can make the stars using only XML attributes and

亲,麻烦给个五星好评!—RatingBar

萝らか妹 提交于 2019-11-28 19:27:21
引言 上一篇的 CheckBox 已经让大家越来越接近实战演练了,本章我们继续分享干货给大家,今天介绍一个实用的UI控件 RatingBar (星级评分条),对于使用过电商APP(某东,某宝等)的小伙伴们来说,应该不会陌生。在对商品进行评价时,经常会出现五星好评的评分样式,这个五星评分样式就是今天的主角 RatingBar 。 简介 RatingBar :用于评分和展示的星级评分控件。 public class RatingBar extends AbsSeekBar java.lang.Object ↳ android.view.View ↳ android.widget.ProgressBar ↳ android.widget.AbsSeekBar ↳ android.widget.RatingBar 由上面的继承结构可以看出, RatingBar 是基于 SeekBar 和 ProgressBar 的扩展。 基本使用 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height=

android - How to set the Rating bar is non clickable and touchable in HTC mobile

橙三吉。 提交于 2019-11-28 15:42:42
问题 My application have rating bars. I want to set the Rating bar is non-click able and no-touchable. For this i added the following code in xml file of each rating bar. It is working in samsung galaxy Apollo GT-i5801. But it is not working in the HTC mobile. Why? xml code android:clickable="false" android:focusableInTouchMode="false" android:focusable="false" thanks 回答1: You could also set the RatingBar as indicator from the xml with the following: android:isIndicator="true" 回答2: Do not set