2011-02-01 185 views
2

我有一个LinearLayoutTextView的数量后面跟着一个ListView在底部 - 请参阅下面的代码。Android ListView和滚动问题

问题是TextView/CheckBox占用了大约75%的屏幕 - ListView在底部有一个滚动,而不是大量使用 - 我如何禁用ListView滚动并启用整个LinearLayout滚动。请提供一些示例代码。

<LinearLayout android:orientation="vertical" 
    android:layout_margin="5dip" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <RelativeLayout android:layout_width="fill_parent" 
     android:layout_margin="5dip" 
     android:layout_height="wrap_content" 
     android:background="#CCCCCC"> 
     <TextView android:id="@+id/_text_title" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/text1" 
      android:layout_marginTop="14dip" 
      android:textColor="#FFFFFF" 
      android:gravity="center_horizontal" 
      android:textSize="17dip" 
      android:textStyle="bold" /> 

      <CheckBox ..../> 
      <CheckBox ..../> 
      <TextView android:id="@+id/_text_title" ..../> 
      <CheckBox ..../> 
      <CheckBox ..../> 
     <ListView .../> 
</LinearLayout> 
+0

你的活动是一个ListActivity? – Stephan 2011-02-01 22:00:57

回答

2

不要把滚动视图内的另一个滚动视图。不起作用。如果遇到这样的问题,您会遇到UI设计缺陷。 UI重新设计/反思即将到来。

2

好吧,所以我找到了解决方案。

我没有代码的手,但大致说来我所做的是,

  1. 创建新类扩展的ListView
  2. 覆盖的onMeasure方法,
  3. 使用的数据集我 - 我知道每行的高度,我计算列表的高度并手动设置。
0

我也面临同样的问题。要删除这个,你必须把你的列表视图放入sap rate布局。