2011-07-30 3 views
1

У меня есть приложение, которое имеет пользовательскую панель рейтингов. Код для того же ниже:Оценка бар в 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 Drawable является:

<?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 звезды в портретном режиме, как показано ниже: enter image description here

но в ландшафтном режиме, то же становится как enter image description here

Кто-нибудь скажет мне, почему, и как я могу обойти эту проблему. Спасибо!

ответ

0

Попробуйте добавить

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

< в свой RatingBar>

+0

The 'layout_width' бит является наиболее важным. Кроме того, http://stackoverflow.com/questions/3858600/how-to-make-ratingbar-to-show-five-stars/10819710 – jsimon

Смежные вопросы