2010-07-03 6 views
1

나는 대화에 대해 다음과 레이아웃이 있습니다스크롤 안드로이드의 ListView에있는 TableView 행

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/categorylist" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:stretchColumns="0"> 
    <TableRow> 
     <ListView 
      android:id="@+id/categorylistview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:isScrollContainer="true" 
      android:scrollbars="vertical" 
      android:scrollbarStyle="insideOverlay" 
     /> 
    </TableRow> 
    <TableRow> 
     <TextView 
      android:text="New Category" 
      ... 
     </TextView> 
    </TableRow> 
    <TableRow> 
     <EditText 
      android:id="@+id/NewCategoryEditText" 
      ... 
     </EditText> 
    </TableRow> 
    <TableRow> 
     <Button 
      android:id="@+id/newcategorybutton" 
      ... 
     /> 
    </TableRow> 
</TableLayout>  

나는 목록보기가 가능한 공간을 사용하는 때까지 성장이 성장 coninues로 이동하려는합니다.

alt text http://heeroz.com/scroll2.png

그러나 목록의 상단에있는 Add 버튼을 가지는 것은 매우 직관적되지 않습니다 : 목록보기와 테이블 행이 TableLayout을의 마지막이 때 잘 작동합니다. "고정 된"테이블 행을 맨 아래로 이동하면 스크롤해야하는 지점으로 커지면 ListView가 화면 밖으로 밀어냅니다. 버튼과 글고보기 테이블 행이 남아 있도록 내 레이아웃을 변경할 수있는 방법

alt text http://heeroz.com/scroll1.png

: 화면을 푸시 할 수 아무것도 다른 왼쪽이있을 때,리스트 뷰는 다음 스크롤을 시작합니다 명백한?

답변

4

LinearLayout 대신 TableLayout을 사용하는 특별한 이유가 있습니까? android:orientation="vertical"? LinearLayout을 사용하는 경우 ListViewandroid:layout_weight="1"을 지정하면 원하는 결과를 얻을 수 있습니다.

+0

나는 특별한 이유를 상기하지 않으므로 귀하의 제안을 시도 할 것입니다. 감사. – cdonner

+0

더 잘 작동하고, 지금까지 어떤 단점도 발견하지 못했습니다. 감사! – cdonner

+0

layout_weight로 작업 할 때 layout_width = "0dp" – Peter

관련 문제