【问题标题】:Custom TableLayout row android自定义TableLayout行android
【发布时间】:2012-09-06 11:59:19
【问题描述】:

我需要将其实现为表格行 - 我有 ID (39004)、标题(我终于达到了一个里程碑)、状态(检查)和价格(456 美元)等字段。我该怎么做?还是以其他方式实现这一点更好?

【问题讨论】:

    标签: android custom-controls row tablelayout


    【解决方案1】:

    我是这样用 RelativeLayout 做的:

    item.xml:

        <?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="wrap_content"
        android:orientation="horizontal"
        android:padding="5dip" 
        android:background="#FFFFFF">
    
        <!-- ListRow Left sied Thumbnail image -->
    
        <LinearLayout
            android:id="@+id/thumbnail"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_marginRight="5dip"
            android:padding="3dip" >
    
            <TextView
                android:id="@+id/altOrderId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ID"
                android:gravity="center|center"
                android:textColor="#040404"
                android:textSize="15dp"
                android:textStyle="bold"
                android:typeface="sans" />
        </LinearLayout>
    
        <!-- Title Of Song -->
    
        <!-- Artist Name -->
    
        <TextView
            android:id="@+id/altOrderTitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="1dip"
            android:textStyle="bold"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="Just gona stand there and ..."
            android:textColor="#000000"
            android:textSize="14dp" />
    
        <!-- Rightend Duration -->
    
        <TextView
            android:id="@+id/altOrderStatus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/altOrderTitle"
            android:layout_alignParentBottom="true"
            android:layout_marginRight="5dip"
            android:layout_toRightOf="@+id/thumbnail"
            android:textColor="#838B8B"
            android:textSize="14dp"
            android:textStyle="bold" />
    
        <!-- Rightend Arrow -->
    
        <TextView
            android:id="@+id/altOrderPrice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/thumbnail"
            android:text="Rihanna Love the way lie"
            android:textColor="#458B74"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans" />
    
    </RelativeLayout>
    

    还有我的 list.xml:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
    
        <ListView
            android:id="@+id/altOrderslist"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:divider="#b5b5b5"
            android:layout_below="@+id/layoutLabel"
    
            android:dividerHeight="1dp"
             />
    
    
    </RelativeLayout>
    

    【讨论】:

    • 这不是自定义表格布局。
    猜你喜欢
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多