开发者

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. The block on the left is an icon.

Much appreciated if you could feedback the correct X开发者_如何学JAVAML tags. 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜