3

i want to set height of rating bar to 23 dp & width to 110 dp .

here is image(url) of layout i require :

http://tinypic.com/r/33c52pw/6

here is my xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="70dp"
    android:background="@color/white"
    android:padding="2dp"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="55dp"
        android:layout_height="55dp"

        android:layout_margin="5dp" />

    <LinearLayout 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1"
        android:paddingTop="5dp">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="waiter_one"
            android:textColor="@color/black"
            />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="dfddd"
           android:layout_marginTop="3dp" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ssss" />

    </LinearLayout>
    <LinearLayout 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:orientation="vertical">
    <LinearLayout 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:orientation="horizontal">

        <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="1710 votes"
        android:layout_gravity="bottom" />

        <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/rateing_bg" />
 </LinearLayout>

  //Commented code of rating bar
  comment(start)
  <RatingBar
        android:id="@+id/ratingBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:numStars="5"
        android:maxWidth="110dp"
        android:maxHeight="23dp" />  comment(end)

 </LinearLayout>


</LinearLayout>

code of rating bar is commented .If i remove comment then causing lot of problem.

4

1 回答 1

2

您必须使用 astyle作为评分栏,例如:

<style name="foodRatingBarSmall" parent="@android:style/Widget.RatingBar.Small">
    <item name="android:progressDrawable">@drawable/food_ratingbar_small</item>
    <item name="android:minHeight">16dip</item>     
    <item name="android:maxHeight">16dip</item> 
</style>

有关更多详细信息,请检查此

于 2012-09-26T13:30:42.783 回答