简体   繁体   English

如何使ListView这样排成一行?

[英]How to make a row of ListView like this?

Sorry, this's my first time to ask a question here. 抱歉,这是我第一次在这里提出问题。 So, I don't have the permission to upload the image to describe. 因此,我无权上传图片进行描述。 Never Mind. 没关系。 What I would like to make is a row of ListView like this. 我要制作的是这样的ListView行。 The block on the left is an icon. 左侧的块是一个图标。

Much appreciated if you could feedback the correct XML tags. 非常感谢您可以反馈正确的XML标签。 Thanks. 谢谢。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------- -------
| | | | some text some text 一些文字一些文字
| | | | some text some text 一些文字一些文字
------- -------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<LinearLayout android:layout_height="wrap_content"
    android:layout_width="fill_parent">
    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:src="@drawable/image" />
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:text="Some text some text some text some text"
        android:layout_weight="1" />
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:text="Some text some text some text some text"
        android:layout_weight="1" />
</LinearLayout>

For the past few hours, I've finally found the solution by myself. 在过去的几个小时中,我终于自己找到了解决方案。 Hopefully, this could do some help to others. 希望这可以对其他人有所帮助。 This is my first contribution to this forum. 这是我对这个论坛的第一个贡献。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="60px">
    <ImageView
        android:layout_centerVertical="true"
        android:id="@+id/image"
        android:layout_height="32px"
        android:layout_width="32px"
        android:layout_marginLeft="20px" />
    <TableLayout
        android:layout_height="fill_parent"
        android:layout_marginRight="0px"
        android:layout_width="fill_parent"
        android:layout_marginLeft="62px">
        <TableRow
            android:minHeight="30px">
            <TableRow
                android:layout_width="fill_parent"
                android:minHeight="40px">
                <TextView
                    android:text="SOME TEXT"
                    android:layout_width="wrap_content"
                    android:ellipsize="end"
                    android:id="@+id/title"
                    android:textSize="10pt"
                    android:width="150px"
                    android:layout_gravity="fill_vertical"
                    android:gravity="bottom"
                    android:minHeight="40px"
                    android:textStyle="bold" />
                <TextView
                    android:text="99999"
                    android:id="@+id/amount"
                    android:textSize="10pt"
                    android:paddingRight="20px"
                    android:minHeight="40px"
                    android:gravity="bottom|right"
                    android:textStyle="bold"
                    android:width="108px" />
            </TableRow>
        </TableRow>
        <TableRow
            android:minHeight="20px">
            <TableRow
                android:layout_width="fill_parent">
                <TextView
                    android:text="SOME TEXT"
                    android:layout_width="wrap_content"
                    android:ellipsize="end"
                    android:id="@+id/description"
                    android:width="150px"
                    android:gravity="top"
                    android:layout_gravity="fill_vertical"
                    android:minHeight="20px" />
                <TextView
                    android:text="some text"
                    android:id="@+id/date"
                    android:paddingRight="20px"
                    android:minHeight="20px"
                    android:gravity="top|right"
                    android:width="108px" />
            </TableRow>
        </TableRow>
    </TableLayout>
</RelativeLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM