2016-06-21 156 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()