zoukankan      html  css  js  c++  java
  • scroollview listview

    引用:http://blog.csdn.net/gumanren/article/details/6781824

    今天写一个成绩表的小程序添加一个ScrollView里面嵌套一个ListView(现在想有点二,ListView自带的有滚动效果的,但还是提出问题跟大家分享哈),碰到了一个问题,不论我的layout_height设置为fill_partent,但不管ListView中添加多少行数据,只能显示二行

    翻了一下文档和百度了一下,还有我的QQ群主hellogv给我的提示:

    Romain Guy write a little info about a ScrollView attribute that is missing  from documentation : android:fillViewport=”true” .
    It must be set to ScrollView and has the following efect : when set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. When the child is taller than the ScrollView, the attribute has no effect.

    当你想让一个高度值不足scrollview的子控件fillparent的时候,单独的定义android:layout_height=”fill_parent”是不起作用的,必须加上fillviewport属性,当子控件的高度值大于scrollview的高度时,这个标签就没有任何意义了。

    解决的办法有2个 :

    1.在ScrollView中添加一属性 android:fillViewport=”true” ,这样就可以让ListView全屏显示了 ;

    2.指定ListView的高度 android:layout_height=”420dp” ;

    修改后的效果

  • 相关阅读:
    (CS模式)大学计算机基础考试系统
    四叶草的祝福
    做人的小故事!
    前天晚上回到北京了
    人生活的三种状态
    松口气了!
    Mysql一些基础用法
    云计算随想
    对vector与deque插值与遍历的性能数据
    gdb命令的常用调试选项
  • 原文地址:https://www.cnblogs.com/sode/p/2406971.html
Copyright © 2011-2022 走看看