【问题标题】:Ratings bar in androidandroid中的评分栏
【发布时间】:2012-12-15 15:47:20
【问题描述】:

我有一个具有自定义评分栏的应用程序。相同的代码如下:

<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 星评分栏,如下所示:

但在横向模式下,同样变成了

谁能告诉我为什么,我该如何规避这个问题。 谢谢!

【问题讨论】:

    标签: android progress-bar


    【解决方案1】:

    尝试添加

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    

    进入你的

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-28
    • 1970-01-01
    • 2015-12-26
    • 2015-05-29
    相关资源
    最近更新 更多