Problema de tamaño vertical de la barra de clasificación de Android

He organizado Ratingbar verticalmente, pero haciendo eso, estoy enfrentando problemas en la gestión de la barra de calificación en el tamaño requerido en la pantalla. He intentado personalizar la imagen y la barra de calificación por defecto siempre. Pero ninguno me está ayudando.

Lo que he hecho hasta ahora es el siguiente:

1) Estilos.xml

<style name="foodRatingBar" parent="@android:style/Widget.RatingBar"> <item name="android:progressDrawable">@drawable/star_rating_bar_full</item> <item name="android:minHeight">48dip</item> <item name="android:maxHeight">48dip</item> </style> 

2) star_rating_bar_full.xml

 <?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/star_ratingbar_full_empty" /> <item android:id="@+android:id/secondaryProgress" android:drawable="@drawable/star_ratingbar_full_empty" /> <item android:id="@+android:id/progress" android:drawable="@drawable/star_ratingbar_full_filled" /> </layer-list> 

3) star_ratingbar_full_empty.xml

 <?xml version="1.0" encoding="utf-8"?> <!-- This is the rating bar drawable that is used to show a filled cookie. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:state_window_focused="true" android:drawable="@drawable/star2" /> <item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/star2" /> <item android:state_selected="true" android:state_window_focused="true" android:drawable="@drawable/star2" /> <item android:drawable="@drawable/star2" /> </selector> 

4) star_ratingbar_full_filled.xml

 <?xml version="1.0" encoding="utf-8"?> <!-- This is the rating bar drawable that is used to show a unfilled cookie. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/star1" /> <item android:state_selected="true" android:state_window_focused="true" android:drawable="@drawable/star1" /> <item android:drawable="@drawable/star1" /> </selector> 

5) VerticalRatingBar.java

 package com.example.ratingbarwidget; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.RatingBar; public class VerticalRatingBar extends RatingBar { private int x, y, z, w; @Override protected void drawableStateChanged() { // TODO Auto-generated method stub super.drawableStateChanged(); } public VerticalRatingBar(Context context) { super(context); } public VerticalRatingBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public VerticalRatingBar(Context context, AttributeSet attrs) { super(context, attrs); } protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(h, w, oldh, oldw); this.x = w; this.y = h; this.z = oldw; this.w = oldh; } @Override protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(heightMeasureSpec, widthMeasureSpec); setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth()); } protected void onDraw(Canvas c) { c.rotate(-90); c.translate(-getHeight(), 0); super.onDraw(c); } @Override public boolean onTouchEvent(MotionEvent event) { if (!isEnabled()) { return false; } switch (event.getAction()) { case MotionEvent.ACTION_DOWN: setSelected(true); setPressed(true); break; case MotionEvent.ACTION_MOVE: setProgress(getMax() - (int) (getMax() * event.getY() / getHeight())); onSizeChanged(getWidth(), getHeight(), 0, 0); break; case MotionEvent.ACTION_UP: setSelected(false); setPressed(false); break; case MotionEvent.ACTION_CANCEL: break; } return true; } @Override public synchronized void setProgress(int progress) { if (progress >= 0) super.setProgress(progress); else super.setProgress(0); onSizeChanged(x, y, z, w); } } 

6) Las imágenes / iconos son los siguientes:

estrella-en la imagen del primer parstar-off imagen del primer parestrella-en la imagen de segundo parintroduzca la descripción de la imagen aquí

7), donde utilicé la barra de puntuación con estilo

  <com.navrideclient.widgets.VerticalRatingBar style="@style/foodRatingBar" android:id="@+id/ratingBar_car" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:numStars="5" android:stepSize="1.0" /> 

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.