我有像 Play 商店应用这样的要求,其中有带有图像和视频的查看寻呼机 并滚动以查看详细信息。不幸的是,当用户滚动时,滚动会跳动,但如果我删除 ScrollView ,则 View 寻呼机工作得很好。
布局外观是这样的 http://cl.ly/MBRB
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:fillViewport="true">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:background="@drawable/loading_image"
android:gravity="top"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/product_image_pager"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/titles"
style="@style/CirclePageIndicator"
android:layout_alignParentBottom="true"
android:padding="10dip"
android:paddingBottom="10dp" />
</RelativeLayout>
<include layout="@layout/app_screen_menu" />
</LinearLayout>
</ScrollView>
顺便说一句,我正在从服务器加载图像。
谢谢
最佳答案
您正在使用 2 个滚动监听器
- viewpager 使用 scrolllistener
- ScrollView 使用滚动监听器
这两个 scrolllistener 正在争夺 ScrollEvent。
您可以通过实现 onInterceptTouch
来解决这个问题。在这种方法中,您可以决定谁赢得了 ScrollEvent 的战斗
看看这个protected post关于包含 2 个 ScrollView 的类似问题
关于android - 嵌入 ScrollView 时查看寻呼机不流畅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14326317/