2010-12-03 11 views
1

나는 다음과 같은 XML을 가지고 스크롤 동작을 오버라이드 (override) 공상 아무것도하고 있지 않다 응답하지 : 임베디드 목록보기가 프레스 긴 프레스에 응답 않지만,있는 ScrollView가

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
    <ScrollView 
     android:id="@+id/myscrollview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:fillViewport="true" 
     android:layout_weight="1"> 
      <ListView 
       android:id="@+id/mylistview" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" /> 
    </ScrollView> 
    <TextView 
     android:id="@+id/my_empty" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:text="@string/my_foo" 
     android:gravity="center" 
     android:visibility="gone" 
    /> 
</LinearLayout> 

그러나을은 스크롤되지 않습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

마지막 TextView는 listview의 emptyview입니다.

+1

당신은 모두 내 눈에 승자입니다. – SapphireSun

답변

4

있는 ScrollView가 스크롤 기본적으로, 즉 웹보기, ListView에 등

는 상대 레이아웃을 시도하고 볼 것을 다른 관점과 잘 재생되지 않습니다 (ListView에 자체에 스크롤 처리합니다.) 불필요 이것이 당신이 원하는 것을한다면.

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

<ListView 
    android:id="@+id/mylistview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_alingParentTop="true" 
/> 
<TextView 
    android:id="@+id/my_empty" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/my_foo" 
    android:gravity="center" 
    android:visibility="gone" 
    android:layout_alignParentBottom="true" 
/> 
</RelativeLayout> 
2

안드로이드에서는 ListView를 ScrollView 내부에 두어서는 안됩니다. 이거 작동 안 할거야.

2

ListView를 ScrollView 밖으로 가져옵니다. 이 문제가 발생하고