java如何使我的ListViewItem看起来像Twitter应用程序?
我希望我的行项目如下所示:
我想有一个左边的图像,顶部和底部的文本和日期。我已经开始规划,但不确定如何处理XML的其余部分:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 安卓:id="@+id/RelativeLayout01" xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content">
<ImageView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_alignParentTop="true"
安卓:layout_alignParentLeft="true"
安卓:id="@+id/avatarImageView">
</ImageView>
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:id="@+id/usernameTextView"
安卓:text="username"
安卓:layout_toRightOf="@+id/avatarImageView"
安卓:layout_alignParentTop="true">
</TextView>
<TextView
安卓:id="@+id/bodyTextView"
安卓:layout_below="@+id/usernameTextView"
安卓:layout_toRightOf="@+id/avatarImageView"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:text="body">
</TextView>
<TextView
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_toRightOf="@+id/usernameTextView"
安卓:id="@+id/dateTextView"
安卓:text="date">
</TextView>
</RelativeLayout>
# 1 楼答案
你会想看看RelativeLayout,像这样的布局容易得多,就像这样
否则,您需要嵌套混合线性布局,例如从左到右的外部线性布局,然后是标题和标题的嵌套垂直线性布局;身体等