• Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
    Java
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[deprecated] sticky view in viewpager which includes scrollview and listview - viewpager with headers

这是一个带有“粘性”功能的viewpager。

ViewPager带有粘性功能,常规的处理方法可能会超级复杂,因为涉及到大量的onTouch监听、拦截,滑动时因为效率问题影响用户体验,不信你去看一下应用宝、豌豆荚的App详情页,然后滑动一下试试。

但是这个demo却使用了很讨巧的方法,里面很少看到onTouch拦截、事件消费的逻辑处理。细看代码你会发现,这个demo使用了障眼法,很巧妙的障眼法。这个障眼法的灵感,来源于另外一款App的处理逻辑,我在滑动时不小心琢磨到了。我没有去反编译,没有去看代码,却猜到了大体的框架,这真是一件很有意思的事情。

viewpager左右滑动的时候,始终有一个view“粘”在顶部。Viewpager左边fragment是scrollView,右边是listview。左右两个fragment上下滑动的时候,都会计算并动态调整stickyView的位置。在viewpager左右滑动的时候,两个fragment的stickyView高度之间的契合也做了调整。在豌豆荚和应用宝的app详情页界面,对stickyView的处理太过生硬,用户体验不太友好。可以参考这个demo的实现方案。

先上两张图如下:

viewpager在上下滑动的时候,对stickyview位置的改变,会存在惯性。大多bug已经修复完成,滑动比较流畅。欢迎拍砖~

备注:
该project使用的水平listview是:https://github.com/MeetMe/Android-HorizontalListView --(只修改了dispatchTouchEvent方法)
viewpager指示器是:https://github.com/astuetz/PagerSlidingTabStrip

More Repositories

1

ViewpagerTransition

viewpager with parallax pages, together with vertical sliding (or click) and activity transition
Java
3,039
star
2

CardSlidePanel

enable users to slide card to the left or right smoothly and continuously
Java
2,385
star
3

AndroidPileLayout

An abnormal horizontal ListView-like pile layout with stretch and contraction effects.
Java
2,157
star
4

VegaLayoutManager

√A customized LayoutManager - fade and shrink the head itemView when scrolling.
Java
1,859
star
5

VerticalSlideFragment

vertical slide to switch to the next fragment page, looks like vertical viewpager
Java
1,606
star
6

DragRankSquare

edit personal information which enables users to drag and rank image order
Java
1,118
star
7

AnimRichEditor

rich text editor which enables users to insert/delete bitmaps and text into edit-view with animations.
Java
976
star
8

android-snake-menu

imitate Tumblr's menu, dragging animations look like a snake
Java
584
star
9

PersistentRecyclerView

京东首页 - 长列表内嵌ViewPager商品流(RecyclerView方案)
Kotlin
308
star
10

PersistentCoordinatorLayout

京东首页 - 长列表内嵌ViewPager商品流(CoordinatorLayout方案)
Kotlin
212
star
11

android-character-animation

in textview, characters come along one by one with random alpha animation
Java
59
star
12

android-slide-to-unlock

imitate ios, slide to unlock, text color gradient animation
Java
47
star
13

AutoWrapLayout

a customized viewgroup wraps textviews and aligns on both left and right sides.
Java
46
star
14

boringArticles

just some articles
19
star
15

MailExtension

chrome插件 - 工资条助手
JavaScript
14
star