开发者

Android ListView and Scroll problem

I have a LinearLayout with a number of TextView followed by a ListView at the bottom - see code below.

The problem is the TextView/CheckBox's take around 75% of the screen - ListView then has a scroll inside it at the bottom, not massively usable - how do I disable the ListView scroll and enable the whole LinearLayout Scroll. Please provide some example code.

<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_co开发者_JAVA技巧ntent"
        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>


Never put a scrollable view inside another scrollable view. It will not work. if you run into such a problem you have a UI design flaw. An UI redesign/rethink is imminent.


Ok, So I found the solution to this.

I dont have the code to hand, but roughly speaking what I did was,

  1. create new class extending ListView
  2. Override the onMeasure method,
  3. Using the data set I have - I know the hight of each row, I calculate the height of the list and set this manually.


I also faced the same problem. To remove this you have to put your list view in sap rate layout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜