简体   繁体   English

如何在不重叠滚动条的情况下显示 Android 右对齐 ListItem 数据?

[英]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.

相关问题 在Android上列出布局,如何使按钮右对齐? - List Layout on Android, how to make buttons right-aligned? Android-如何强制微调框下拉列表打开右对齐 - Android - How to force spinner dropdown to open right-aligned Android - 使用右对齐视图进行布局椭圆化 - Android — Layout ellipsize with right-aligned view 带有右对齐检查按钮/框的Android CheckBox - Android CheckBox with right-aligned checking button/box 当屏幕宽度较小时,如何在右对齐按钮旁边省略居中对齐的文本视图 - How to ellipsize center-aligned textview beside a right-aligned button when screen width is small 具有右对齐,裁剪,未缩放内容的ImageView - ImageView with right-aligned, cropped, unscaled content ListView行样式 - 左对齐文本和右对齐图标 - ListView row styling - left aligned text, and right-aligned icon 如何为有一个TextView左对齐和一个TextView右对齐的ListView行创建XML布局? - How do I make an XML layout for a ListView row where there is a TextView left-aligned and a TextView right-aligned? RelativeLayout不会包装右对齐的TextView - RelativeLayout won't wrap right-aligned TextView 我想在android中创建自定义标签栏,标签必须右对齐,内容必须在左侧 - I want to create custom tab bar in android, The tabs must be right-aligned and contents must be at the left-side
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM