---
title: "ratingBar demo"
author: "aking86"
date: "2012-10-18T23:54:06Z"
tags: []
categories: ["移动开发"]
slug: "ratingbar-demo"
draft: false
lastmod: "2012-10-19T00:02:45Z"
id: 1701306
url: "https://aking86.iteye.com/blog/1701306"
---

关于 ratingBar

参考 资料写的demo

**http://www.cnblogs.com/over140/archive/2010/11/18/1880391.html**

写道

&lt;RelativeLayout  
android:layout\_width="fill\_parent"  
android:layout\_height="wrap\_content" &gt;

&lt;TextView  
android:id="@+id/tv\_hotel"  
android:layout\_width="wrap\_content"  
android:layout\_height="wrap\_content"  
android:layout\_alignParentLeft="true"  
android:layout\_centerVertical="true"  
android:text="China hotel"  
android:textSize="18dp" /&gt;

&lt;ImageView  
android:id="@+id/iv\_right"  
android:layout\_width="wrap\_content"  
android:layout\_height="wrap\_content"  
android:layout\_alignParentRight="true"  
android:layout\_centerVertical="true"  
android:src="@drawable/ic\_right" /&gt;

&lt;TextView  
android:id="@+id/tv\_distance"  
android:layout\_width="wrap\_content"  
android:layout\_height="wrap\_content"  
android:layout\_centerVertical="true"  
android:layout\_margin="5dp"  
android:layout\_toLeftOf="@+id/iv\_right"  
android:text="30km" /&gt;

&lt;RatingBar  
android:id="@+id/rb\_stars"  
style="?android:attr/ratingBarStyleSmall"  
android:layout\_width="wrap\_content"  
android:layout\_height="wrap\_content"  
android:layout\_centerVertical="true"  
android:layout\_toLeftOf="@+id/tv\_distance"  
android:isIndicator="true"  
android:numStars="6"  
android:rating="5.0"  
android:stepSize="1.0" /&gt;  
&lt;/RelativeLayout&gt;