2012-09-13 23 views
-1

enter image description here定製TableLayout行的Android

我需要實現這一個作爲一個錶行 - 我等領域的ID(39004),標題(我終於達到了一個里程碑),狀態(檢查)和價格($ 456 )。我該怎麼做?或者更好地以其他方式實現這一點?

回答

0

我與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> 
+0

這不是自定義表佈局。 –