Android 中的评分栏
我有一个具有自定义评级栏的应用程序。其代码如下:
<LinearLayout style="@style/FillWrap.LL.Footer"
android:layout_width="fill_parent" android:weightSum="1">
<ImageView android:id="@+id/IV_Prev" android:src="@drawable/left_arrow"
style="@style/Wrap" android:layout_weight="0.35" />
<RatingBar android:id="@+id/RB_Stars" style="@style/Wrap"
android:progressDrawable="@drawable/ratings_bar" android:numStars="3"
android:layout_weight="0.3" android:stepSize="1" />
<ImageView android:id="@+id/IV_Next" android:src="@drawable/right_arrow"
style="@style/Wrap" android:layout_weight="0.35" />
</LinearLayout>
ratings_bar 可绘制的代码是:
<?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/ic_swipe_fav_off_default"/>
<item android:id="@android:id/progress" android:drawable="@drawable/ic_swipe_fav_focused" />
</layer-list>
我能够在纵向模式下看到一个带有 3 颗星的正确评级栏,如下所示:
但在横向模式下,同样变得像
有人可以告诉我原因吗?如何避免此问题。 谢谢!
I have an application that has a custom Ratings bar. The code for the same is below:
<LinearLayout style="@style/FillWrap.LL.Footer"
android:layout_width="fill_parent" android:weightSum="1">
<ImageView android:id="@+id/IV_Prev" android:src="@drawable/left_arrow"
style="@style/Wrap" android:layout_weight="0.35" />
<RatingBar android:id="@+id/RB_Stars" style="@style/Wrap"
android:progressDrawable="@drawable/ratings_bar" android:numStars="3"
android:layout_weight="0.3" android:stepSize="1" />
<ImageView android:id="@+id/IV_Next" android:src="@drawable/right_arrow"
style="@style/Wrap" android:layout_weight="0.35" />
</LinearLayout>
The code for the ratings_bar drawable is:
<?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/ic_swipe_fav_off_default"/>
<item android:id="@android:id/progress" android:drawable="@drawable/ic_swipe_fav_focused" />
</layer-list>
I'm able to see a proper rating bar with 3 stars in the portrait mode as below:
but in the landscape mode, the same becomes like
Can some one tell me why, and how can I circumvent this problem.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试添加
到您的 <评分栏>
Try adding
into your < RatingBar >