2017-09-24 1 views
-1

私はrecyclerview list.byのアイテムの評価を表示しようとしています。私はカスタム定格星の色と空の星の色で試してみました。しかしうまくいきません。問題は、5つ星がすべてそこに表示されていません(4つ星が表示されます)。私は星の選択した空の色をカスタマイズしたいと思っていましたが、それも動作しません。ここ は私のアダプターのコードです:ここ評価バーは、ラップコンテンツとカスタムスタイルで動作していない5つ星をすべて表示していません。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_marginTop="5dp"> 


    <ImageView 
     android:layout_width="110dp" 
     android:layout_height="110dp" 
     android:id="@+id/productImageViewId_deal" 
     android:src="@drawable/wad_logo_sparkle" 
     android:layout_centerVertical="true" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp" 
     android:fitsSystemWindows="true" 
     android:scaleType="fitCenter" 
     /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/productTitleTvId_deal" 
     android:text="£25,500 FORD GALAXY TITANIUM " 
     android:layout_marginLeft="5dp" 
     android:textColor="#0e4f71" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:textStyle="bold" 
     android:textSize="16sp" 
     /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/productDescTvId_deal" 
     android:text="2.0 5DR HEATED FRONT SEATS, ACTIVE PAR" 
     android:layout_marginLeft="5dp" 
     android:textColor="#000000" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:layout_below="@+id/productTitleTvId_deal" 
     android:textSize="14sp" 
     /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/productLocTvId_deal" 
     android:text=" Ilford, 0, England" 
     android:drawableLeft="@drawable/location_icon" 
     android:layout_marginLeft="5dp" 
     android:textColor="#777" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:layout_below="@+id/productDescTvId_deal" 
     /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/productPostTimeTvId_deal" 
     android:text="May 06, 2016, 12:1914" 
     android:layout_marginLeft="5dp" 
     android:textColor="#000000" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:layout_below="@+id/productLocTvId_deal" 
     /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="£25,000.00" 
     android:id="@+id/productPriceTvId_deal" 
     android:layout_marginLeft="5dp" 
     android:paddingBottom="10dp" 
     android:textColor="#1470a6" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:layout_below="@+id/productPostTimeTvId_deal" 
     /> 

    <RatingBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:max="5" 
     android:layout_toEndOf="@+id/productImageViewId_deal" 
     android:layout_below="@+id/productPriceTvId_deal" 
     android:theme="@style/RatingBar" 
     android:layout_marginRight="10dp" 
     /> 

</RelativeLayout> 

スタイルです:

<style name="RatingBar" parent="Theme.AppCompat"> 

     <item name="colorControlNormal">#1470A6</item> 
     <item name="android:colorBackground">#c44</item> 
    </style> 

enter image description here

答えて

0

私はたくさんの方法と終わりがない良い結果をテストしています。 style="@style/Widget.AppCompat.RatingBar.Indicator" を使用するか、MaterialRatingBarなどのライブラリを使用できます。

+0

よろしくお願いいたします。 – AAA

関連する問題