Android 文本视图覆盖

Android 文本视图覆盖,android,listview,textview,restrict,Android,Listview,Textview,Restrict,我想知道如何解决这个问题 现在我的处境是这样的: 我有一个包含项目的列表视图。项目由标题(textview)和固定在右侧的数字(textview)组成(以圆形可绘制形状为背景的textview) 但我的问题是,当我的标题太长时,它会覆盖数字 我想知道如何对我的布局进行编码,使我的标题不会覆盖其他文本视图。所以在数字的左边会有一条虚线。如果标题太长,它会出现在下一行,不会覆盖我的号码 谢谢你的帮助 以下是我的listitem代码: **自定义\u列表\u item.xml:** <?xml

我想知道如何解决这个问题

现在我的处境是这样的: 我有一个包含项目的列表视图。项目由标题(textview)和固定在右侧的数字(textview)组成(以圆形可绘制形状为背景的textview)

但我的问题是,当我的标题太长时,它会覆盖数字

我想知道如何对我的布局进行编码,使我的标题不会覆盖其他文本视图。所以在数字的左边会有一条虚线。如果标题太长,它会出现在下一行,不会覆盖我的号码

谢谢你的帮助

以下是我的listitem代码:

**自定义\u列表\u item.xml:**

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/transparent"
    android:paddingTop="10dp" >

    <TextView
        android:id="@+id/tvFach"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginBottom="10dp"
        android:text="@string/fach_grid"
        android:textColor="@color/white"
        android:paddingLeft="5dp"
        android:textSize="30sp" />

    <TextView
        android:id="@+id/tvAverage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="10dp"
        android:background="@drawable/circle_list_item"
        android:text="@string/average"
        android:textColor="@color/white"
        android:textSize="30sp" />

    <View
        android:id="@+id/separator"
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:background="@color/white" />

</RelativeLayout>

我想试试这个:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:paddingTop="10dp" >

 <ImageView
        android:id="@+id/tvAverageImage"
        android:layout_width="wrap_content"
        android:layout_centerVertical="true"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:src="@drawable/ic_menu_mark"
        android:layout_alignParentRight="true"
        android:paddingLeft="5dp" />

    <TextView
        android:id="@+id/tvAverage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginBottom="10dp"
        android:layout_alignParentRight="true"
        android:text="average"
        android:textColor="@color/white"
        android:paddingLeft="5dp"
        android:textSize="30sp" />

    <TextView
        android:id="@+id/tvFach"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@id/tvAverage"
        android:layout_centerVertical="true"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="10dp"
        android:text="fach_grid"
        android:textColor="@color/white"
        android:textSize="30sp" />

    <View
        android:id="@+id/separator"
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:background="@color/white" />

</RelativeLayout>


LinearLayout可以,RelativeLayout并不是为了禁止重叠而设计的。或者你可以做一个水平方向的线性布局。这个布局的问题是,我的编号是,即使它的alignParentRight=true,我的编号下一个(在圆圈中)是正确的到标题,圆圈从标题后一直拉伸到列表的末尾,itemStill's not work number仍然位于标题和背景后,仍然拉伸!但是已经谢谢你的提示了!tvAverage textview是否应为设定宽度?如果设置背景并调整视图大小,它将始终拉伸。你可以在文本视图后面使用图像视图。你的确切意思是什么?我怎样才能做到这一点?