【发布时间】:2011-07-26 09:16:46
【问题描述】:
我有一个这样定义的 ScrollView:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollv"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.test.myview android android:id="@+id/myview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</ScrollView>
MyView 是从 View 扩展而来的。
在 MyView 中,我绘制了一个比例为 1.5 的位图。似乎 scollview 工作正常,因为当我向上或向下滚动时会出现褪色边缘,但是在 onDraw() 中绘制的图像(如 drawBitmap(bm..))不会滚动以显示“隐藏”部分..它滚动2px然后停止..当它到达onScrollChanged(int,int,int,int)时-我知道那里的所有值都是0..我什至尝试使用scollTo或显式设置滚动scrollBy 方法,没有帮助。所以我想这是我弄错的内容......
我做错了吗?我使用的 CustomView 是基本视图,或多或少覆盖了一些常用方法(onMeasure、onDraw、onTouchEvent...)。
【问题讨论】:
标签: java android scrollview