开发者

ScrollView and CustomView scrolling

I have a ScrollView defined like this:

<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>

And MyView is extended开发者_运维知识库 from View.

in MyView I have a Bitmap drawn with scale of 1.5. It seems as the scollview is working fine since the fading edges appear when I scroll up or down, but then the Image that is drawn in onDraw() (as drawBitmap(bm..)), is not scrolled to show the 'hidden' parts .. it scrolls for 2px's and then stops.. when it gets to onScrollChanged(int, int, int, int) - I get that all of the values are 0 there.. I even try to explicitly set the scroll with scollTo or scrollBy methods, no help. So I suppose it's the content that I am mistakening somehow...

Am I doing something wrong? The CustomView I use is basic View with more or less of the common methods overriden (onMeasure, onDraw, onTouchEvent...).


You need to use a fixed width and height for your custom view.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜