2012-08-29 2 views
-1

스크롤보기 내에서 목록보기를 만들고 있는데 목록보기가 해당 부모와 일치하도록하고 싶습니다. 스크롤보기가 상위 화면과 일치하고 전체 화면을 얻습니다. 하지만 내부의 선형 레이아웃은 njzk2 말했듯이, 당신은 할 수 없어, 부모와 일치하는 전체 화면 acquirig, 목록보기부모와 일치하지 않는 Android 선형 레이아웃

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


    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 


<LinearLayout 
    android:id="@+id/linearlayout1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

      <ListView 
       android:id="@+id/listView" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" > 

      </ListView> 
</LinearLayout> 
    </ScrollView> 




</LinearLayout> 
+12

ScrollView 내에서 ListView를 사용하지 않아도됩니다. ListView는 이미 스크롤 할 수 있으며이를 사용하면 문제가 발생할 수 있습니다. 대부분 동적 크기 (고정 크기 요소가 더 잘 수행되어야 함)를 사용하는 경우 – njzk2

+0

고맙습니다. 스크롤보기와 선형 레이아웃을 제거했습니다. –

답변

1

예로서 그렇게되지 않습니다. scrollview에서 ListView에 문제가 있습니다.

ListView를 사용하지 않습니다. 난 그냥 일반적으로 버튼을 사용합니다. 그들은 훨씬 잘 작동합니다.

2

있는 ScrollView 또는 있는 LinearLayout 목록보기를 사용할 필요에 따라하지으로 코드를 바꿉니다 기본 스크롤을 제공합니다.

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
      <ListView 
       android:id="@+id/listView" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
      </ListView> 
    </LinearLayout> 
관련 문제