my rating bar not completely aline in single row see image http://imgur.com/vRGrXU1 last star will not show completely how i will fix this please help me how i will fix this to rating bar show all 5 star completely help me
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10sp" >
<EditText
android:id="@+id/Email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:singleLine="true" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="Give rating"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="1"
android:rating="0" />
<EditText
android:id="@+id/Comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="10dp"
android:hint="Comments"
android:minLines="3" >
</EditText>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/Submitbtn"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Submit" />
<Button
android:id="@+id/btn_cancel"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/Submitbtn"
android:text="Cancel" />
</RelativeLayout>
</LinearLayout>
RatingBar needs a static width and you don't have it, as it wont autmatically adjust its star size, so find it a space and instead of
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="1"
android:rating="0" />
you need
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="150dp" <!-- or whatever static size that fits-->
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="1"
android:rating="0" />
--EDIT--
If you want to make it smaller but not as much as @nurisezgin answer you could style your RatingBar but you will also need the static width, another solution if you are using that layout in dialog you could set the minimum width of that dialog,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:minWidth="300dp"
android:padding="10dp" > // also use dp for padding instead of sp
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句