2012-08-06 3 views
0

이것은 제 레이아웃이고 테이블 레이아웃을 코딩하여 테이블 행에 추가하고 싶습니다.테이블 레이아웃이 내 레이아웃의 내용을 감싸고 있습니다.

layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/bgblack" 
    android:orientation="vertical" > 
    <ScrollView 
     android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/linearLayout1" > 

    <RelativeLayout 
      android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/bgblack" 
     android:orientation="vertical" > 
    <TextView 
      android:id="@+id/section_phone" 
       android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/linearLayout1" 
       android:background="@color/Grey" 
      android:padding="2dp" 
      android:text="@string/section_phone" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="@android:color/white" 
      android:textStyle="bold" /> 
     <RelativeLayout 
      android:id="@+id/detail_phone" 
       android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/section_phone" > 
       <TableLayout 
       android:id="@+id/list_phone" 
        android:layout_width="fill_parent" 
       android:layout_height="wrap_content" > 
      </TableLayout> 
     </RelativeLayout> 
     </RelativeLayout> 
</ScrollView> 
</RelativeLayout> 

tablerow.xml

<?xml version="1.0" encoding="utf-8"?> 
<TableRow xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 
    <LinearLayout 
     android:id="@+id/details" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 
     <TextView 
      android:id="@+id/detail_phone_title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="@color/Blue" /> 
     <TextView 
      android:id="@+id/detail_phone_subtitle" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:drawableRight="@drawable/ic_contact_call" 
      android:padding="5dp" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="@android:color/white" /> 
    </LinearLayout> 
</TableRow> 

하지만 출력 테이블 행의 전체 폭에 오지 않을 때 참조. 그것은 단지 포장 내용으로오고있다.

출력

Output of layout with half

그래서 당신이 날 전체 화면으로 출력을하는 데 도움이 될 수 있습니다?

답변

0

선택한 열을 늘리면 문제가 해결됩니다. 이 링크를 참조하십시오. TableLayout.html#attr_android:stretchColumns

<!-- The zero-based index of the columns to stretch. --> 
<TableLayout 
     android:id="@+id/list_phone" 
     android:stretchColumns="0" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    </TableLayout> 
+0

감사합니다. Shaiful ... 이것은 내가 원하는 것입니다. 잘 작동합니다. –

관련 문제