2012-07-16 3 views
0

일부 빈 단추가있는 테이블보기가 있습니다. 내 앱을 실행하면 모든 버튼이 상단에 밀어 넣어집니다. 테이블이 전체 화면 영역을 차지하게하려면 어떻게해야합니까?모든 화면 공간을 사용하도록 테이블 뷰를 강제 설정하는 방법은 무엇입니까?

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 
<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <Button 
     android:id="@+id/button1" 
     /> 
</TableRow> 

내 배치는 사실은 꽤 큰, 그래서 여기에 질문에서 이해 답이므로이는

+2

어떤 종류의 레이아웃을 만들려고합니까? 가능한 스냅인 –

+1

코드를 게시하십시오. XML 레이아웃도 –

+0

게시하십시오. –

답변

1
<TableLayout android:stretchColumns="*" ... > 

, 당신은 열을 지정할 수 있습니다하는 것은 늘어나는 것과 할 수, 예를 들어, "1"또는 "1,2,3"

1

단지 샘플입니다

당신이 행에 무게를 줄 수 있습니다. 마찬가지로 : 대신에 *의

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tableLayout1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

<TableRow 
    android:id="@+id/tableRow1" 
    android:layout_width="fill_width" 
    android:layout_height="wrap_content" 
    android:gravity = 1.0 > 
    <Button 
     android:id="@+id/button1" 
     android:text="button" /> 
</TableRow> 

<TableRow 
    android:id="@+id/tableRow2" 
    android:layout_width="fill_width" 
    android:layout_height="wrap_content" 
    android:gravity = 1.0 > 
    <Button 
     android:id="@+id/button1" 
     android:text="button" /> 
</TableRow> 

관련 문제