2012-07-24 6 views
7

하나의 TableLayout이있는 선형 레이아웃이 있습니다. 테이블 레이아웃에는 각각 두 개의 열이있는 두 개의 행이 있습니다. 첫 번째 테이블 행에는 두 개의 이미지가 있습니다. 두 번째 테이블 행에는 두 개의 버튼이 있습니다.Android TableLayout 높이가 전체 화면을 채우지 않습니다.

그러나 이것은 전체 화면에 표시되지 않고 처음 절반에만 표시되거나 이미지 높이에 따라 달라질 수 있습니다. 두 이미지는 실제로 같은 파일이지만 다른 너비로 표시됩니다. ... 여기

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"> 

    <TableLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:stretchColumns="*"> 

     <TableRow 
      android:layout_height="fill_parent"> 

      <ImageView 
       android:id="@+id/tp_image" 
       android:layout_width="0dip" 
       android:layout_height="fill_parent" 
       android:layout_weight="0.9" 
       android:scaleType="fitXY" 
       android:src="@drawable/images" /> 

      <ImageView 
       android:id="@+id/s_image" 
       android:src="@drawable/images" 
       android:layout_width="0dip" 
       android:layout_height="fill_parent" 
       android:scaleType="fitXY" 
       android:layout_weight="0.1" 
       /> 
     </TableRow> 
     <TableRow > 
      <Button 
       android:id="@+id/button_LC" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/button_LC"/> 
      <Button 
       android:id="@+id/button_RC" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/button_RC"/> 
     </TableRow> 
    </TableLayout> 
</LinearLayout> 

답변

13

두 테이블 행 또는 단지 첫 번째 행에

<TableRow 
    android:layout_height="0dp" 
    android:layout_weight="1" > 

을 설정 레이아웃 파일을입니다 도와주세요.

+0

은 첫 번째 TableRow에 대해서만 마술처럼 작동합니다. 이 속성들은 백그라운드에서 무엇을합니까? – Anjanu

+1

[레이아웃 무게 설명] (http://stackoverflow.com/questions/3995825/what-does-androidlayout-weight-mean) –

관련 문제