2016-06-21 266 views
0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 

    android:layout_height="140dp" 
    android:background="@color/colorPrimary"> 


    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="200dp" 
     android:layout_alignParentBottom="true" 
     android:layout_below="@+id/image" 
     android:layout_centerHorizontal="true" 
     android:fillViewport="true" 
     android:scrollbars="vertical" 

     > 


     <TextView 
      android:id="@+id/prayerMessage" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:text="please God forgive me for all my mistakes i have ever done in my life please God forgive me for all my mistakes i have ever" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="#ffffff" 

      /> 

    </ScrollView> 
</RelativeLayout> 

這是我的xml文件,滾動視圖不滾動。滾動視圖不滾動自定義視圖內的列表視圖

任何人都可以請建議一個解決方案?

我使用一個ListView自定義視圖中使用自定義適配器滾動視圖的

+0

該XML文件在這裏給出的動態佈局加法? ListView項目? – Marat

+0

似乎這是ListView項目...建議不要在ListView中使用ScrollViews,因爲它幾乎違背了ListView的目的......有很多關於StackOverflow和Internet上的帖子。佈局中還存在多個其他錯誤:RelativeLayout具有比scrollview更小的設置高度。但即使你這樣做,你也不會看到結果,因爲嵌套滾動容器不支持嵌套滾動 –

回答

0

高度爲200dp。由於200dp適合屏幕,因此無需滾動。您可以嘗試的高度設置爲

android:layout_height="match_parent" 

android:layout_height="wrap_content" 

如果你的UI項目高度都較大然後屏幕尺寸。

+0

它不能正常工作 –

1

不建議在對方內使用多個可滾動視圖。你在列表視圖中使用ScrollView,你不應該這樣做。這是一個不好的做法。

而是使用通過 view.add()