vertical slide to switch to the next fragment page.
仿照淘宝和聚美优品,在商品详情页,向上拖动时,可以加载下一页。使用ViewDragHelper,滑动比较流畅。
scrollView滑动到底部的时候,再行向上拖动时,添加了一些阻力。
vertical slide to switch to the next fragment page, looks like vertical viewpager
第一页底部有可以横向滚动的控件时有滑动冲突。样式参考京东商品详情页第一页底部。能否搞得和京东一样的效果
重现方法:
我用了 TabLayout结果 点击 马上 返回 第一页
崩溃堆栈信息:
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:849)
at android.support.v4.widget.ViewDragHelper.processTouchEvent(ViewDragHelper.java:1160)
at com.stone.verticalslide.DragLayout.onInterceptTouchEvent(DraggableLayout.java:203)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2109)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at in.srain.cube.views.ptr.PtrFrameLayout.dispatchTouchEventSupper(PtrFrameLayout.java:255)
at in.srain.cube.views.ptr.PtrFrameLayout.dispatchTouchEvent(PtrFrameLayout.java:331)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2405)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737)
at android.app.Activity.dispatchTouchEvent(Activity.java:2835)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2366)
at android.view.View.dispatchPointerEvent(View.java:9526)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4278)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4144)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3685)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3738)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3704)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3830)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3712)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3887)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3685)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3738)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3704)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3712)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3685)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5970)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5944)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5905)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6073)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootI
hello ,this is my layout structure:
dragLayout
----- fragment0
--------- scrollview0
------fragment1
---------- button0 button1 botton2
-----------viewPager
--------------fragment2,fragment3,fragment4
button0.1.2 are use to switch the viewPager's fragments.
my issue is that I can't scroll up to fragment0 in viewPager,can you help me?
你好,我在底部fragment中嵌入了一个viewpager,发现底部不能滑动上去了哦 左右也不能滑
什么时候支持recyclerView?,thx!
第二页放ListView,内容不能下滑,展示不了全部的数据,
在viewpager里面嵌套DragLayout,好像viewpager自身不能左右滑动,请问有解决方案没?望不吝赐教。
补充一下,因为我在您已关闭的问题中发现有人跟我一样的疑问:就是Viewpager里面有一个Fragment,Fragment内部包含DragLayout,天猫APP中的商品详情页就是这样的应用场景。
CustScrollView 内部有个控件高度会发生变换,初始化后正常使用,如高度发生变换就无法上拉了,有什么解决方法吗?尝试requestLayout 并不起作用
DragLayout放在ViewPager中不兼容咋办?
你好,我在底部的fragment中放置了一个viewpager,viewpager包含2个子fragment,放置的分别是custlistview和custwebview,但是目前viewpager无法左右滑动,求解!
点个赞
在4.1.1的模拟器上,首页fragment里使用draglayout,当程序启动,快速切换到第二个tab,在切换会第一个tab的时候,首页就白板了,请问大神有什么好的解决办法吗,是因为库本身就存在这个问题吗?
把 CustScrollView 作为底组件时候,拉动到底部页面时候,无法拉动回到顶部页面
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:848)
at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1052)
at com.jimei.xiaolumeimei.widget.doubleview.DragLayout.onInterceptTouchEvent(DragLayout.java:143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1886)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2243)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1986)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2243)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1548)
at android.app.Activity.dispatchTouchEvent(Activity.java:2509)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2069)
at android.view.View.dispatchPointerEvent(View.java:7901)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4295)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3733)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3783)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3752)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3859)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3760)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3916)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3733)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3783)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3752)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3760)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3733)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5899)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5863)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5834)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5979)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5952)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5998)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:542)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5032)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
onViewPosChanged
方法里:有的时候会默认白板,这个很恶心。后面有时间再优化
这个能重现么,我不能复现这个问题,还有,这个应该需要怎么解决呢。
onTouchEvent
方法里mDragHelper.processTouchEvent(e); // 该行代码可能会抛异常,正式发布时请将这行代码加上try catch
这行代码,会抛异常这个问题具体情况是怎么样的呢?比如具体的 异常信息。
嗯,非常感谢这个库如果你能提供上述问题的信息或者解决方案的话,那就再好不过了
今天使用了大神这个库,刚开始没发现又有什么问题,很顺利,有一次,用as跑应用,手机自动锁屏了,跑完之后,打开手机一看,直接白板,多试了几次,一直都有,请问这个是什么原因造成的呢
大神,能指点一下么?
下面是我的布局:
<TextView
android:id="@+id/no_comment_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:focusable="false"
android:text="暂无评论"
android:textColor="@color/color_919090"
android:textSize="@dimen/text_size_12"/>
<com.mayi.ui.verticalslide.CustListView
android:id="@+id/pull_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:descendantFocusability="afterDescendants"
android:divider="@null"
android:fadingEdge="none"
android:fastScrollEnabled="false"
android:listSelector="#00000000"
android:scrollbars="none"
android:smoothScrollbar="true"
android:visibility="visible"
/>
发现添加一个textview后,CustListView失效了
我想实现点击按钮跳转下一页,请问要怎么弄?,能提供一个方法吗?
你好,我现在在做京东的商品详情页效果,一个Activity中包含3个Fragment(简介,详情,评价)用ViewPager做容器,简介Fragment中用的DragLayout并且头部还有一个ViewPager,现在滑动到最后一张需要切换到详情,发现实现不了,移动的时候事件都被DragLayout中的ViewDragHelper处理了,求指点一二,万分感谢
我在第二个Fragment中放了一个ViewPager,ViewPager中是两个Fragment,如果ViewPager中的fragment放滑动控件就上拉不了,不放滑动控件就正常,滑动控件我都用了你写的CusListView或者CusScrollView,事件分发真的好难
主界面ViewPager布局:
会话fragment-----------联系人fragment-----------设置fragment
会话fragment布局:
<?xml version="1.0" encoding="utf-8"?>
<com.mosant.mosantim.widget.DragLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dragLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/fragment_communication_top" />
<include layout="@layout/fragment_communication_normal" />
</com.mosant.mosantim.widget.DragLayout>
注:fragment_communication_normal默认的布局,fragment_communication_top下拉展示的布局
第一次安装(或者清数据后),此时使用了ViewPager.setCurrentItem(1)默认展示联系人fragment界面
ViewPager默认显示第二页时,DragLayout没有布局,显示成默认背景色(白板),切换tab也无效。不过重新启动app后恢复正常(此时ViewPager默认展示会话fragment界面),也不会再复现。
希望得到解答,非常感谢!
把Demo中的CustWebView作为第一个fragment显示,无法滑动切换到下一页!
/**
* 初始化View
*/
private void initView() {
fragment1 = new VerticalFragment1();
fragment3 = new VerticalFragment3();
getSupportFragmentManager().beginTransaction()
.add(R.id.second, fragment1)
.add(R.id.first, fragment3)
.commit();
}
查了一下: 应该是你的event touch中只判断了是否在顶部方法,而没有判断是否在底部了,导致needConsumeTouch = true而无法改变。。。
不知道我说的对不对?
我现在的情况是上面一个fragment嵌套了scrollview下面的frament是一个viewpagerviewpager包含2个fragment 每个fragment里面又是scrollview 我的scrollview是按照你代码里的custwebview写处理滑动事件~但是不能不能往上滑动,是用2台小米手机测试的。
你好,很喜欢这个组件,但在使用中遇到一些问题
现有Fragment1跟Fragment2,在Fragment2中使用CustScrollView嵌套了CustListView
且复写了CustListView的如下方法
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); }
然后,就无法正常滑动了,请问该如何解决
还望赐教~因为继续向上滑动的话,会出现空白页或者就是一部分底部view的重叠
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.