How to show Android Right-aligned ListItem data without overlapping the scrollbar?
I've basically the same thing as ListView row styling - left aligned text, and right-aligned icon : a listview with listitems in it that are right-aligned:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal开发者_如何转开发"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:text="Name"
android:id="@+id/list_item_name"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
>
</TextView>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:text="0x0 0s"
android:id="@+id/list_item_value"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
>
</TextView>
</RelativeLayout>
and it works fine.. .except that the list_item_value text is obscured by the scrollbar. There's plenty of blank space between the names and values, scooting all the values to the left a little would be fine, but I don't know how to do that either.
try setting android:layout_marginRight
on list_item_value
. Try a value like 10dp or so - just to get a feel, then adjust accordingly.
精彩评论