Padding offsets the content of a View
(in your case pushing the content to the right) so instead of:
android:paddingLeft="15dp"
try to use:
android:layout_marginLeft="15dp"
Question
I have a listview of ratingbar where user needs to rate different items(images) on scale of 1 to 7. I have used a linearlayout with imageview and ratingbar as the layout for my listview. However for some unknown reason ratingbar doesn't take up the complete available space and my last star is shown incomplete.
And my layout file is as follows
<?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="wrap_content"
android:minHeight="40dp"
android:padding="10dp" >
<ImageView
android:id="@+id/logo"
android:layout_width="80dp"
android:layout_height="match_parent"
android:padding="5dp"
android:scaleType="centerInside" />
<RatingBar
android:id="@+id/ratingbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:isIndicator="false"
android:paddingLeft="15dp"
android:stepSize="1.0" >
</RatingBar>
</LinearLayout>
I set numStars in my code. If i increase numstars to 8, same thing happens, 7 stars appears as complete and last star comes as incomplete.
Solution
Padding offsets the content of a View
(in your case pushing the content to the right) so instead of:
android:paddingLeft="15dp"
try to use:
android:layout_marginLeft="15dp"