[英]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:我基本上与ListView 行样式相同 - 左对齐文本和右对齐图标:其中包含右对齐的列表项的列表视图:
<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.它工作正常......除了 list_item_value 文本被滚动条遮挡。 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
.尝试在
list_item_value
上设置android:layout_marginRight
。 Try a value like 10dp or so - just to get a feel, then adjust accordingly.尝试 10dp 左右的值 - 只是为了感受一下,然后进行相应调整。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.