android视差
⑴ 32个实用酷炫的Android开源UI框架
1.Side-Menu.Android
分类侧滑菜单 , Yalantis 出品。
项目地址: https://github.com/Yalantis/Side-Menu.Android
2.Context-Menu.Android
可以方便快速集成漂亮带有动画效果的上下文菜单, Yalantis 出品。
项目地址: https://github.com/Yalantis/Context-Menu.Android
3.Pull-to-Refresh.Rentals-Android
提供一个简单可以自定义的 下拉刷新 实现,Yalantis 出品。
项目地址: https://github.com/Yalantis/Pull-to-Refresh.Rentals-Android
4.Titanic
可以显示水位上升下降的TextView
项目地址: https://github.com/RomainPiel/Titanic
5.AndroidSwipeLayout
滑动Layout ,支持单个View,ListView,GridView
项目地址: https://github.com/daimajia/AndroidSwipeLayout
Demo地址: Download Demo
6.Android Typeface Helper
可以帮你轻松实现自定义字体的库
项目地址: https://github.com/norbsoft/android-typeface-helper
7.android-lockpattern
Android的图案密码解锁
项目地址: https://code.google.com/p/android-lockpattern/
Demo地址: https://play.google.com/store/apps/details?id=group.pals.android.lib.ui.lockpattern.demo
文档介绍: https://code.google.com/p/android-lockpattern/wiki/QuickUse
APP示例:Android开机的图案密码解锁,支付宝的密码解锁
8.ToggleButton
状态切换的 Button,类似 iOS,用 View 实现
项目地址: https://github.com/zcweng/ToggleButton
9.WilliamChart
绘制图表的库,支持LineChartView、BarChartView和StackBarChartView三中图表类型,并且支持 Android 2.2及以上的系统。
项目地址: https://github.com/diogobernardino/WilliamChart
Demo地址: https://play.google.com/store/apps/details?id=com.db.williamchartdemo
Demo项目: https://github.com/diogobernardino/WilliamChart/tree/master/sample
10.实现滑动ViewPager渐变背景色
项目地址: https://github.com/TaurusXi/GuideBackgroundColorAnimation
11.Euclid
用户简历界面, Yalantis 出品。
项目地址: https://github.com/Yalantis/Euclid
12. InstaMaterial
Instagram的一组Material 风格的概念设计
项目地址: https://github.com/frogermcs/InstaMaterial
13. SpringIndicator
使用bezier实现粘连效果的页面指示
项目地址: https://github.com/chenupt/SpringIndicator
14. BezierDemo
仿qq消息气泡拖拽 消失的效果。
项目地址: https://github.com/chenupt/BezierDemo
15. FoldableLayout
折叠的信纸被打开一样的动画效果
项目地址: https://github.com/alexvasilkov/FoldableLayout
16.Taurus
下拉刷新,Yalantis 出品。(是不是有点似曾相识呢?)
项目地址: https://github.com/Yalantis/Taurus
17. PersistentSearch
在点击搜索的时候控件在原有位置显示输入框。
项目地址: https://github.com/Quinny898/PersistentSearch
18. circular-progress-button
带进度显示的Button
项目地址: https://github.com/dmytrodanylyk/circular-progress-button
19. discrollview
当上下滚动的时候子元素会呈现不同动画效果的scrollView,网页上称之为:视差滚动
项目地址: https://github.com/flavienlaurent/discrollview
20. sweet-alert-dialog
一个带动画效果的 自定义对话框样式
项目地址: https://github.com/pedant/sweet-alert-dialog
21. android-floating-action-button
Material Desig风格的 浮动操作按钮
项目地址: https://github.com/futuresimple/android-floating-action-button
22. android-collapse-calendar-view
可以在月视图与周视图之间切换的calendar控件
项目地址: https://github.com/blazsolar/android-collapse-calendar-view
22. android-collapse-calendar-view
可以在月视图与周视图之间切换的calendar控件
项目地址: https://github.com/blazsolar/android-collapse-calendar-view
23. NumberProgressBar
个简约性感的数字进度条
项目地址: https://github.com/daimajia/NumberProgressBar
24. CircularProgressView
CircularProgressView 是通过自定义view的方式实现的Material风格的加载提示控件,兼容任何版本。
项目地址: https://github.com/rahatarmanahmed/CircularProgressView
25. OriSim3D-Android
opengl 实现了各种折纸效果,模拟了从一张纸折叠成一条船的整个过程
项目地址: https://github.com/RemiKoutcherawy/OriSim3D-Android
26、万能日历控件:CalendarView
GitHub: https://github.com/huanghaibin-dev/CalendarView
中文使用文档: https://github.com/huanghaibin-dev/CalendarView/blob/master/QUESTION_ZH.md
27、大图查看器: BigImage ImageView ViewPager
Github: https://github.com/SherlockGougou/BigImageViewPager
地址: https://www.jianshu.com/p/b15e65791c3f
支持超长图、超大图的图片浏览器,优化内存,支持手势放大、下拉关闭、查看原图、加载百分比、保存图片等功能。现已支持androidx。
28、安卓工具包androidUntilCode(安卓必备)
Github: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README-CN.md
29、万能适配器-BRAVH
官网: http://www.recyclerview.org
GitHub: https://github.com/CymChad/BaseRecyclerViewAdapterHelper
RecyclerView
作为Android最常用的控件之一,是否常常为“她”操碎了心
BRVAH受益群体是所有Android开发者,希望更多开发者能够一起来把这个项目做得更好帮助更多人
30、智能刷新控件--SmartRefreshLayout
GitHub: https://github.com/scwang90/SmartRefreshLayout
中文: https://gitee.com/scwang90/SmartRefreshLayout
SmartRefreshLayout以打造一个强大,稳定,成熟的下拉刷新框架为目标,并集成各种的炫酷、多样、实用、美观的Header和Footer。 正如名字所说,SmartRefreshLayout是一个“聪明”或者“智能”的下拉刷新布局,由于它的“智能”,它不只是支持所有的View,还支持多层嵌套的视图结构。 它继承自ViewGroup 而不是FrameLayout或LinearLayout,提高了性能。 也吸取了现在流行的各种刷新布局的优点,包括谷歌官方的 SwipeRefreshLayout , 其他第三方的 Ultra-Pull-To-Refresh 、 TwinklingRefreshLayout 。 还集成了各种炫酷的 Header 和 Footer。
31、内存泄漏检测工具--leakcanary
使用方式: https://www.jianshu.com/p/b83ddffcb3b5
LeakCanary是Square公司基于MAT开源的一个工具,用来检测Android App中的内存泄露问题。官方地址: https://github.com/square/leakcanary
32、 1218683832 / AndroidSlidingUpPanel
SlidingUpPanelLayout:可以上下滑动的菜单布
https://github.com/1218683832/AndroidSlidingUpPanel
⑵ Android 协调布局
依赖
layout_scrollFlags 属性
1、scroll:影响向下滚动(默认不设置的值)
Child View 伴随着滚动事件而滚出或滚进屏幕。
注意两点:
第一点,如果使用了其他值,必定要使用这个值才能起作用;
第二点:如果在这个child View前面的任何其他Child View没有设置这个值,那么这个Child View的设置将失去作用
发生向下滚动是,优先滚动Scrolling View,当优先滚动的一方已经全部滚进屏幕之后,另一方才开始滚动
2、enterAlways : 影响向下滚动
对比scroll和scroll | enterAlways设置,发生向下滚动事件时,前者优先滚动Scrolling View,后者优先滚动Child View,
效果:当优先滚动的一方已经全部滚进屏幕之后,另一方才开始滚动
3、enterAlwaysCollapsed:影响向下滚动
一般:scroll|enterAlways|enterAlwaysCollapsed
child View需设定最小值,即minHeight。
效果:向下滚动时,Child View先向下滚动最小高度值,然后Scrolling View开始滚动,到达边界时,Child View再向下滚动,直至显示完全
4、exitUntilCollapsed:影响向上滚动
这里也有最小高度,即有没有设置minHeight,一般不设置
效果:发生向上滚动时,Child View向上滚动退出直到最小高度,然后Scrolling View开始滚动。一般minHeight不设置,所以它就会完全滚出屏幕
5、snap
Child View滚动比例的一个吸附效果。也就是说,
效果:Child View不会存在局部显示的情况,滚动Child View的部分高度,当我们松开手指时,Child View要么向上全部滚出屏幕,要么向下全部滚进屏幕,有点类似ViewPager的左右滑动
layout_collapseMode 属性
1.parallax:视差模式,在折叠的时候会有折叠视差效果。一般搭配layout_collapseParallaxMultiplier=“0.5”视差的明显程度be between 0.0 and 1.0.
2.none:没有任何效果,往上滑动的时候toolbar会首先被固定并推出去。
3.pin:固定模式,在折叠的时候最后固定在顶端。
⑶ Android的ScrollView示例
ScrollView 绝对是各种教材、教程都或多或少遗漏的一个非常重要的视图。凡是这个界面的组成非常不规则,而且竖直方向长度不够就肯定需要使用 Scrollview 了。因为 ListView 处理的是规则的内容。至于带视差效果的滚动自然是ScrollView的产物。本文会通过一个简单的例子,讲述如何使用Scrollview。
多数的Android应用都会出现内容尺寸超出屏幕的情况。比如一则新闻页,有配图,在配图下可以点击按钮了解更多,有标题,最后是全部的新闻内容,假设这则内容是勇士打败骑士队后詹姆斯又跑去哪里抱大腿的新闻。那么ListView显然不是最好的选择,但是一般的Layout,比如 LinearLayout 、 RelativeLayout 或者 FrameLayout 之类Layout也没法用。最后就只有 ScrollView 可以解决问题了。
ScrollView 就是这么一种特殊的布局。当 ScrollView 的内容大于他本身的size的时候, ScrollView 会自动添加滚动条,并可以竖直滑动。
原文地址: http://javatechig.com/android/android-scrollview-example
⑷ android parallaxscrollview怎么用
ParallaxScrollView实现具有视差滚动(Parallax Scroll)效果的滚动视图。所谓视差滚动,就是屏幕有两层滚动视图,两层滚动视图的滚动速度不一样,一般来说前面的滚动视图的滚动速度比底部的滚动视图的滚动速度要快,从而造成三维滚动效果。可以调整视差滚动参数,参数越小,两层的滚动速度相差越大,视差滚动效果越明显。
⑸ Android如何在CollapsingToolbarLayout 中实现点击事件
上一篇博客我们学习了Android Design SuppZ㖞�"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcnQgTGlicmFyeb/i1tC1xCDKx7j2vPK1pbXE1+m8//NPGJyIC8+DQpBbmRyb2lkIE3Qwr//NztLDx7zM0PjRp8+wRGVzaWv+LW0LXExuTL+8vEuPbX6bz+xOO1xLmks8zW0NL9yOs8L3A+DQo8cHJlIGNsYXNzPQ=="brush:java;">compile 'com.android.support:design:22.2.0'
AppBarLayout
效果图是这样的
AppBarLayout 是继承LinerLayout实现的一个ViewGroup容器组件,它是为了Material Design设计的App Bar,支持手势滑动操作。
默认的AppBarLayout是垂直方向的,它的作用是把AppBarLayout包裹的内容都作为AppBar。类似上面图片贴出来的效果,代码布局如下:
?
1
2
3
4
5
6
7
<code avrasm="" class="hljs">
</android.support.v7.widget.toolbar>
</android.support.design.widget.tablayout></android.support.design.widget.appbarlayout></code>
此处将Toolbar 和Tablayout的组合部分共同构成 AppBar的效果。
注意: AppBarLayout必须作为Toolbar的父布局容器
AppBarLayout是支持手势滑动效果的,不过的跟CoordinatorLayout配合使用,接下来学习一下CoordinatorLayout组件怎么使用?
CoordinatorLayout
从开发文档中可以了解到,CoordinatorLayout是一个增强型的FrameLayout。它的作用有两个
作为一个布局的根布局 最为一个为子视图之间相互协调手势效果的一个协调布局
例如一下布局代码:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<code avrasm="" class="hljs"> <!--?xml version=1.0 encoding=utf-8?-->
</android.support.design.widget.tablayout></android.support.v7.widget.toolbar></android.support.design.widget.appbarlayout>
<!--可滑动的布局内容-->
</android.support.design.widget.floatingactionbutton></android.support.v7.widget.recyclerview></android.support.design.widget.coordinatorlayout></code>
从上面布局看到,CoordinatorLayout协调布局中包裹了两个布局,一个是NestedScrollView,一个是AppBarLayout,以及FAB按钮。
我们来看看CoordinatorLayout是怎么来协调这两个子视图手势操作的。
1.由于CoordinatorLayout是FrameLayout布局,我们可以通过
?
1
<code avrasm="" class="hljs">android:layout_gravity=bottom|end</code>
属性来控制组件在整个布局中的位置,比如上面效果中的FAB就是通过android:layout_gravity=”bottom|end”来确定 FAB的位置在底端的最右边的位置。
2.为了达到上面效果图的手势动画效果,我们必须做如下设置,通过app:layout_scrollFlags=”scroll|enterAlways” 属性来确定哪个组件是可滑动的
设置的layout_scrollFlags有如下几种选项:
scroll: 所有想滚动出屏幕的view都需要设置这个flag- 没有设置这个flag的view将被固定在屏幕顶部。 enterAlways: 这个flag让任意向下的滚动都会导致该view变为可见,启用快速“返回模式”。 enterAlwaysCollapsed: 当你的视图已经设置minHeight属性又使用此标志时,你的视图只能已最小高度进入,只有当滚动视图到达顶部时才扩大到完整高度。 exitUntilCollapsed: 滚动退出屏幕,最后折叠在顶端。
我们上面的布局中 给Toolbar设置了app:layout_scrollFlags属性,因此,Toolbar是可以滚动出屏幕,且向下滚动有可以出现。
3.为了使得Toolbar可以滑动,我们必须还得有个条件,就是CoordinatorLayout布局下包裹一个可以滑动的布局,比如 RecyclerView,NestedScrollView(经过测试,ListView,ScrollView不支持)具有滑动效果的组件。并且给这些组件设置如下属性来告诉CoordinatorLayout,该组件是带有滑动行为的组件,然后CoordinatorLayout在接受到滑动时会通知AppBarLayout 中可滑动的Toolbar可以滑出屏幕了。
?
1
<code class="hljs" perl="">app:layout_behavior=@string/appbar_scrolling_view_behavior</code>
总结: 为了使得Toolbar有滑动效果,必须做到如下三点:
CoordinatorLayout必须作为整个布局的父布局容器。 给需要滑动的组件设置 app:layout_scrollFlags=”scroll|enterAlways” 属性。 给你的可滑动的组件,也就是RecyclerView 或者 NestedScrollView 设置如下属性:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<code class="hljs" markdown=""> app:layout_behavior=@string/appbar_scrolling_view_behavior
```
##CollapsingToolbarLayout

CollapsingToolbarLayout包裹 Toolbar 的时候提供一个可折叠的 Toolbar,一般作为AppbarLayout的子视图使用。
CollapsingToolbarLayout 提供以下属性和方法是用:
1. Collapsing title:ToolBar的标题,当CollapsingToolbarLayout全屏没有折叠时,title显示的是大字体,在折叠的过程中,title不断变小到一定大小的效果。你可以调用setTitle(CharSequence)方法设置title。
2. Content scrim:ToolBar被折叠到顶部固定时候的背景,你可以调用setContentScrim(Drawable)方法改变背景或者 在属性中使用 app:contentScrim=?attr/colorPrimary来改变背景。
3. Status bar scrim:状态栏的背景,调用方法setStatusBarScrim(Drawable)。还没研究明白,不过这个只能在Android5.0以上系统有效果。
4. Parallax scrolling children:CollapsingToolbarLayout滑动时,子视图的视觉差,可以通过属性app:layout_collapseParallaxMultiplier=0.6改变。
5. CollapseMode :子视图的折叠模式,有两种“pin”:固定模式,在折叠的时候最后固定在顶端;“parallax”:视差模式,在折叠的时候会有个视差折叠的效果。我们可以在布局中使用属性app:layout_collapseMode=parallax来改变。
布局代码如下:
</code>
?
1
2
3
4
5
<code class="hljs" markdown="">
***总结:*** CollapsingToolbarLayout主要是提供一个可折叠的Toolbar容器,对容器中的不同视图设置layout_collapseMode折叠模式,来达到不同的折叠效果。
1.Toolbar 的高度layout_height必须固定,不能 “wrap_content”,否则Toolbar不会滑动,也没有折叠效果。
2.为了能让FloatingActionButton也能折叠且消失出现,我们必须给FAB设置锚点属性</code>
?
1
<code class="hljs" perl="">app:layout_anchor=@id/appbar</code>
意思是FAB浮动按钮显示在哪个布局区域。
且设置当前锚点的位置
app:layout_anchorGravity=”bottom|end|right”
意思FAB浮动按钮在这个布局区域的具体位置。
两个属性共同作用才是的FAB 浮动按钮也能折叠消失,出现。
3.给需要有折叠效果的组件设置 layout_collapseMode属性。
【转载请注明出处:http://blog.csdn.net/feiclear_up/article/details/46514791 CSDN 废墟的树】
NavigationView
http://www.2cto.com/kf/201506/409067.html
⑹ android-ultra-pull-to-refresh怎么换刷新的动画
首先是Ultra-Pull-To-Refresh的特点,此库提供了一个Layout类:PtrFramLayout作为Wrapper来包涵ContentView,今天用到两个方法:第一个PtrFramLayout#setHeaderView(View)用来设置头部显示的刷新View,第二个PtrFramLayout#addPtrUIHandler(PtrHandler)用来设置监听用户下拉状态、下拉offset、刷新完成状态等。
其次是动画的,根据效果图,第一点是下拉的时候人物从左侧走过来到中间,到中间后手指再继续往下拉,此时人物也不走了,第二点是当手指松开时或者处于下拉状态时,人物不停的走动,并且背景产生一个相对位移,给人的视觉上造成一个视觉差,也就是我们想要的视差动画了,这就是整个视差动画的实现步骤。