2011-12-11 3 views
3

전체 활동을 한 번에 스크롤하고 싶지만 내 ScrollView에 포함 된 ListView는 확장되지 않습니다. 그냥 첫 번째 행을 볼 수 있지만 listView 스크롤 할 때 다른 행을 스크롤 할 수 있습니다. 은 내가 필요한 것은 ... 높이가 목록보기 만 주요있는 ScrollView를 스크롤하지 않고도 표시가 포함되어 있으므로 모든 항목을 확장 할 수있는 목록보기의 주요 목적Android : 스크롤없이 목록 뷰를 부모에게 채우는 방법?

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="5dp" 
     android:orientation="vertical" 
     android:layout_weight="1" > 
     <LinearLayout 
      android:id="@+id/header_Layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="horizontal" > 

     ... 

     </LinearLayout> 
     <TextView 
      android:id="@+id/comment" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dp" 
      android:layout_marginTop="5dp" 
      android:background="@drawable/gradient_background" 
      android:text="@string/comments" 
      android:textColor="#000000" 
      android:textStyle="bold" > 
     </TextView> 

     <ListView 
      android:id="@+id/commentsListView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="fill" 
      android:divider="@drawable/gradient_divider" 
      android:dividerHeight="1dp" /> 
    </LinearLayout> 
</ScrollView> 
+0

이 게시물을 참조 할 수 있습니다. http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing –

답변

4

한 ListView를가입니다입니다 스크롤하는 동안 셀을 재활용 할 수 있습니다. 모든 셀을 존재 시키려면 ListView가 필요하지 않습니다. 세로로 배치 된 LinearLayout을 사용하면됩니다.

+0

네 말이 맞아. ! ListView가 필요하지는 않지만 간단한 LinearLayout으로 동일한 결과를 얻을 수 있습니다. 난 그냥 손으로 분배기를 처리해야합니다. – user1026605

관련 문제