为了构建应用程序,我们有几个列表。列表项存在问题,这是自定义的,但非常简单。格式为:
这代表一个带有 2 个文本视图和一个图像视图的列表项
请注意,标题和日期实际上是在彼此下方,图像在右侧,中心垂直作为属性。图像不应位于两个文本视图之间
我将先给出 XML,然后再解释确切的问题。
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="16dip"
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:textSize="12dip"
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="5dip" >
<ImageView
android:id="@+id/validationStateImg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</LinearLayout>
问题: 从某种意义上说,这种布局完全按照 ascii 表示形式显示所有内容。当文本变长时,无法正常工作。在文本很长但不足以占用 2 行的情况下,它只会使图像视图变得很小。
在其他情况下,它只是将 imageview 完全推离屏幕。
我需要的是,当日期或其他文本视图的长度太长时,不能换行。当然,它需要是一种可移植到各种屏幕尺寸的解决方案。
我不是 UI 艺术家,因此,如果我在某种意义上滥用布局,我表示歉意,因为它们不应该被使用。
除了帮助,也欢迎提示和提示!