当前位置: 代码迷 >> Android >> 一个android页面过长显示不上的有关问题
  详细解决方案

一个android页面过长显示不上的有关问题

热度:52   发布时间:2016-05-01 12:01:17.0
求助:一个android页面过长显示不下的问题
本帖最后由 wzh_xwjh 于 2012-12-26 13:09:11 编辑
  最近遇到一个蛋疼的问题,一个页面里面有几个LinearLayout和几个ListView,ListView里面又有很多Item,接下来就是问题了——一屏显示不完的Layout怎么都翻不出来。像下面这个Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
……/>
<ListView
android:id="@+id/semesterlistview"
……
</ListView>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
……/>
<ListView
android:id="@+id/checkcodelistview"
</ListView>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
……/>
<ListView
android:id="@+id/optionalcourselistview"
</ListView>
</LinearLayout>

<TextView
android:id="@+id/totalcredit"
</LinearLayout>
这个布局里面嵌了3个LinearLayout,每个LinearLayout里面一个ListView,如果前两个ListView把屏幕占满了,那么后一个LinearLayout和最后那个TextView都显示不出来了。尝试了下用ScrollView,但那样改了过后每个ListView都变得很畸形,挤在一起了,也看到有的文档里面说ScrollView里面不能嵌ListView。翻了很多书,百度了很多资料都没解决,无奈之下 发帖求高人指教!!!不胜感激!!!!

------解决方案--------------------
你能不能给listview限定一下高度?
------解决方案--------------------
在ListView外面套一个Lilayout 限定高度  当然为了适应多分辨率 最好是把整个屏幕 进行分块
------解决方案--------------------
最好给listview设置下高度,如果不方便设绝对值,可以考虑使用layout_weight,设置比重
------解决方案--------------------
我觉得就是用scrollview就可以解决
  相关解决方案