簡體   English   中英

如何在不重疊滾動條的情況下顯示 Android 右對齊 ListItem 數據?

[英]How to show Android Right-aligned ListItem data without overlapping the scrollbar?

我基本上與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>

它工作正常......除了 list_item_value 文本被滾動條遮擋。 名稱和值之間有很多空格,將所有值向左移動一點就可以了,但我也不知道該怎么做。

嘗試在list_item_value上設置android:layout_marginRight 嘗試 10dp 左右的值 - 只是為了感受一下,然后進行相應調整。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM