当前位置:编程学习 > wap >>

画面纵向滚动条拖拽的问题!~

小弟现在遇到一个问题。首先我在画面的最外层用了一个ScrollView,然后在里边套了一个LinearLayout。LinearLayout中有
一个TextView控件,现在要求当TextView显示的内容比较多时,出现纵向滚动条。我将这个TextView在xml进行了如下设置
<TextView android:layout_width="fill_parent" android:layout_height="220px" android:id="@+id/txtResult" android:scrollbars="vertical"></TextView>并在代码中做了如下的设置
  tvResult.setMovementMethod(ScrollingMovementMethod.getInstance());
然后,出现的问题时滚动条出来了,但是无法拖拽。
  然后我就换了一种实现方式,就是在把TextView的android:scrollbars="vertical"属性去掉以后,外层又加了一个ScrollView,这次滚动条还是出来了 仍旧不能拖拽。
  但如果我将最外层的ScrollView去掉就可以了。我运行的虚拟机2.3版本的,我在2.1版本上运行时是好的,2.2版本就不行了...

求高手解 --------------------编程问答-------------------- 是不是组件放得太多了? --------------------编程问答--------------------   如果我将最外层的ScrollView去掉,在上述的两种实现方式下都可以通过用鼠标点住画面,进行上下的拖动。但当我加上最外层的ScrollView后,就无法拖动了,但是可以如果滚动鼠标中间滑轮的话还是管用的。(注:在此时竖屏状态下,最外层的滚动条是不会出现的,次滚动条是在横屏状态下用的)。

  我运行的虚拟机环境是2.33,我在2.1的虚拟机和手机下运行过了,是没有这个问题的。但再到2.2,2.3下就不行了。求高手解

附上整个xml的代码

  <?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="@+id/scrollResult" 
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent"> 
    <LinearLayout android:id="@+id/LinearLayout"  android:orientation="vertical" android:scrollbars="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
        <TextView android:id="@+id/tvBank" android:layout_width="wrap_content" android:layout_span="2" android:layout_height="30px"></TextView>
        <TextView android:layout_width="wrap_content" android:text="@string/label_parameter" android:layout_height="30px" android:textSize="18sp" android:id="@+id/txtParameterLabel"></TextView>
        <HorizontalScrollView  android:id="@+id/HorizontalScrollView" android:layout_height="30px" android:layout_span="2" android:layout_width="fill_parent" >
            <TextView android:layout_width="fill_parent" android:layout_height="30px" android:id="@+id/txtParameter"></TextView>
        </HorizontalScrollView>
            <TextView android:layout_width="wrap_content" android:text="@string/label_result" android:layout_span="2" android:layout_height="30px" android:textSize="18sp" android:id="@+id/txtResultLabel"></TextView>
            <TextView android:layout_width="fill_parent" android:layout_height="220px" android:id="@+id/txtResult" android:scrollbars="vertical"></TextView>
<TextView android:id="@+id/tvBank" android:layout_width="wrap_content" android:layout_span="2" android:layout_height="25px"></TextView>
            <Button android:textSize="18sp" android:text="@string/btnBack" android:id="@+id/btnBack" android:layout_height="50px" android:visibility="visible" android:layout_width="160px"></Button>
    </LinearLayout>
</ScrollView> --------------------编程问答-------------------- 自己顶一下~ --------------------编程问答-------------------- 没人了解吗?顶一下啊
补充:移动开发 ,  Android
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,