我在Android应用程序中定制了View
,它被放在HorizontalScrollView
的内部,如图所示。滚动查看发生在触摸滚动的位置后
<HorizontalScrollView
android:id="@+id/feedBackScroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<com.my.views.OfflineFeedbackView
android:id="@+id/feedBackView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/session_rec_page_title_bar_height"
android:layout_marginBottom="@dimen/session_rec_page_ctrl_bar_height"/>
</HorizontalScrollView>
的OfflineFeedbackView
表明,我玩的音频轨道的间隔赛道,我滚动通过基于当前播放时间调用scrollTo(newXPos, newYPos)
这一观点。我面临的问题是,如果通过触摸滚动屏幕然后开始播放,滚动的引用似乎在我的视图中发生变化,并且滚动发生在通过触摸滚动到的位置。我浏览了API文档,发现scrollTo(newXPos, newYPos)
内部调用onScrollChanged(int l, int t, int oldl, int oldt)
,其中oldl
和oldt
分别是旧的水平和垂直原点。所以,我从中解释的是,当我通过触摸屏幕来滚动这些原点值时就会发生变化。所以,我也试过拨打onScrollChanged(newX, newY, 0, 0)
,但这只是冻结了屏幕,没有滚动。难道我做错了什么?什么可以是其他更好的方法来处理这个问题?