Android开源:一个支持竖向滚动的 Android ViewPager 实现

bzyv8574 7年前
   <h2>VerticalViewPager</h2>    <p>A vertical scrollable ViewPager implementation.Works well with vertical RecyclerView and ListView, though i havn't test it with other View, but i believe it will work too. Feel free to use it with other View.</p>    <p>In the latest work, we need a vertical scrollable ViewPager, and Android ViewPager only support horizontal scroll, there are already some work such as <a href="/misc/goto?guid=4958969804133769500" rel="nofollow,noindex">kaelaela/VerticalViewPager</a> and <a href="/misc/goto?guid=4959740291422208434" rel="nofollow,noindex">DragScrollDetailsLayout</a> , but they are not meet our conditions. So I figure out an implementation and build this project.</p>    <h2>Screenshots</h2>    <p style="text-align:center"><img src="https://simg.open-open.com/show/fe1a9d78af8d0862da5f3a68770a1e78.gif"> <img src="https://simg.open-open.com/show/19827d47ed86487a5fe287c8f94fc7f5.gif"></p>    <h2>How does it work?</h2>    <p>Use ViewPager's fake drag feature and View.OnTouchListener to manage the touch events.</p>    <ul>     <li>DummyViewPager override the onInterceptTouchEvent method and return false, dispatch touch events to it's children;</li>     <li>Set VerticalVPOnTouchListener as the View.OnTouchListener of the child view (RecyclyerView\ListVeiw...), VerticalVPOnTouchListener manages the child view's scroll and fake the ViewPager's scroll;</li>     <li>Read the source code.</li>    </ul>    <p>I build my project based on <a href="/misc/goto?guid=4958969804133769500" rel="nofollow,noindex">kaelaela/VerticalViewPager</a> , but we use completely different implementations.</p>    <h2>Next:</h2>    <ul>     <li>Add more examples;</li>     <li>Better ReadMe;</li>    </ul>    <h2>Me</h2>    <p>Chad Guo</p>    <ul>     <li><a href="/misc/goto?guid=4959740291510557763" rel="nofollow,noindex">guochongscut@gmail.com</a></li>    </ul>    <h2>License</h2>    <p>Please <a href="/misc/goto?guid=4959740291600310520" rel="nofollow,noindex">LICENSE</a> 。</p>    <p> </p>    <p> </p>