2011-10-11 6 views
0

긴 TextViews가 포함 된 ScrollView를 스크롤 할 때 이상한 문제가 발생합니다. 여기 내 XML 코드입니다 :ScrollView에서 TextView가 잘못 표시됩니다.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/scroller" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fillViewport="true" > 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 
    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="6dip" 
     android:paddingRight="6dip" 
     android:paddingTop="6dip" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="Welcome to My Application" /> 

    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:background="#ff106510" 
     android:layout_marginLeft="6dip" 
     android:layout_marginRight="6dip" 
     android:layout_marginTop="6dip" 
     android:layout_marginBottom="12dip" /> 

    <TextView 
     android:id="@+id/longText" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1.0" 

     android:paddingLeft="6dip" 
     android:paddingRight="6dip" 
     android:paddingBottom="6dip" 

     android:text="@string/hello"/> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 

     android:background="@android:drawable/bottom_bar" 
     android:gravity="center_vertical"> 
     <Button 
      android:layout_width="0dip" 
      android:layout_weight="1.0" 
      android:layout_height="wrap_content" 

      android:text="Accept" /> 
     <Button 
      android:layout_width="0dip" 
      android:layout_weight="1.0" 
      android:layout_height="wrap_content" 

      android:text="Refuse" /> 
    </LinearLayout> 
</LinearLayout> 

다음

내가 원하는 걸 얻었 : The screen shot before scroll

하지만 스크롤 할 때 문제가 발생합니다 enter image description here

이 이제까지 일이 있었나요 당신? 나는 HTC 2.2 프로토 타입 인 SDK2.3.3의 에뮬레이터에서 테스트했는데, 이것은 항상 발생합니다. 왜 이런 일이 일어 났는지 말해 줄 수 있습니까?

답변

0

난 그냥 근본 원인을 발견 이 같은 AndroidManifest.xml에 내 활동을 정의로 :

<activity 
    android:name=".views.ScrollViewActivity" 
    android:label="@string/scroll_view_sample" 
    android:theme="@style/Theme.NoBackground"> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.MY_CUSTOMER_INTENT" /> 
    </intent-filter> 
</activity> 

NoBackground 테마는 다음과 같이 정의된다 :

<resources> 
    <style name="Theme.NoBackground" parent="android:Theme"> 
     <item name="android:windowBackground">@null</item> 
    </style> 
</resources> 

을하고 때를 android : theme = "@ style/Theme.NoBackground"줄을 삭제하면 잘 동작합니다.

0

XML 끝 부분에 </ScrollView>이 누락되어 있지 않습니까?

EDIT : BTW Archos 70 2.2에서 XML을 사용해보십시오 ... 스크롤하는 동안 문제가 없습니다.