嵌入在scrollview中时,查看寻呼机是不是很流畅? [英] view pager not smooth when embedded within scrollview?

查看:119
本文介绍了嵌入在scrollview中时,查看寻呼机是不是很流畅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有像播放商店应用程序的要求,其中有图像和视频的视图寻呼机
并滚动查看详细信息。不幸的是,当用户滚动滚动是跳跃但如果我删除滚动视图,视图寻呼机工作完全正常。

I have requirement like play store app where there is view pager with images and videos and scroll to view details .Unfortunately when user scrolls the scroll is jumpy but if i remove the scrollview the view pager works perfectly fine .

布局外观如下所示
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>

顺便说一句,我正在从服务器加载图片。

Btw i am loading images from server .

谢谢

推荐答案

您正在使用2个滚动浏览器

You are using 2 scrollisteners


  • 一个viewpager使用一个scrolllistener

  • 一个scrollview使用一个scrolllistener

这些两个scrollistener正在争夺ScrollEvent。
您可以通过实现 onInterceptTouch 来解决这个问题。在这种方法中,你可以决定谁赢得了ScrollEvent的战斗

These two scrollistener are fighting for the ScrollEvent. You can solve this by implementing onInterceptTouch. In this method you can decide who wins the fight over the ScrollEvent

看看这个受保护的帖子

这篇关于嵌入在scrollview中时,查看寻呼机是不是很流畅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆