Android Studio安装以及Fetching android sdk component information超时的解决方案

在经过两年的开发之本后,Google 公司终于发布了 Android Studio 1.0,喜欢折腾的童鞋们,抓紧折腾吧。。。。。 一、下载Android Studio 1.0: 1)可以在谷歌Android官网下载Android Studio 1.0(链接)。下载不了的童鞋可以到百度网盘上下载(链接)。 2)下载后,Android Studio 1.0 二、安装Android Studio 1.0: <span style="color: #0000ff;"> <span style="color: #000000;">1)直接双击![](http://images.cnitblog.com/blog/695756/201412/100950433845238.png)进行安装。</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> 2)直接一直下一步就可以。中间如果想修改安装目录的可以进行修改:</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> ![](http://images.cnitblog.com/blog/695756/201412/100953418063713.png) </span></span> # <span style="color: #0000ff;">三、解决Fetching android sdk component information加载过久问题</span> <span style="color: #0000ff;"><span style="color: #000000;"> 安装完成后,如果直接启动,Android Studio会去获取 android sdk 组件信息,这个过程相当慢,还经常加载失败,导致Android Studio启动不起开。解决办法就是不去获取android sdk 组件信息。方法如下:</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> 1)进入刚安装的Android Studio目录下的bin目录。找到idea.properties文件,用文本编辑器打开。</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> 2)在idea.properties文件末尾添加一行:<span style="color: #ff0000;">disable.android.first.run=true</span>,然后保存文件。</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> 3)关闭Android Studio后重新启动,便可进入界面。</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> ![](http://images.cnitblog.com/blog/695756/201412/101004062754693.png)</span></span> # <span style="color: #0000ff;">四、新建一个Android工程项目</span> <span style="color: #0000ff;"><span style="color: #000000;"> 1)启动Android Studio后的界面:</span></span> <span style="color: #0000ff;"><span style="color: #000000;"> ![](http://images.cnitblog.com/blog/695756/201412/101004436962892.png)</span></span> <span style="color: #ff0000;">备注:这里需要配置下sdk,感谢博客园朋友们的提醒:</span> a、点击进入configure: ![](http://images.cnitblog.com/blog/695756/201412/101957450712770.png) b、进入界面后,再点击project Defaults: ![](http://images.cnitblog.com/blog/695756/201412/101959196185054.png) c、进入界面后,再点击Project Structure: ![](http://images.cnitblog.com/blog/695756/201412/102002137759526.png) d、进入界面后,设置Android SDK和JDK的路径。 ![](http://images.cnitblog.com/blog/695756/201412/102003264781538.png) 2)点击start a new android studio project,创建一个Android项目(可以修改工程的工作空间) ![](http://images.cnitblog.com/blog/695756/201412/101009122288363.png) 3)直接下一步 ![](http://images.cnitblog.com/blog/695756/201412/101011291038680.png) 4)再下一步 ![](http://images.cnitblog.com/blog/695756/201412/101012503219925.png) 5)再下一步 ![](http://images.cnitblog.com/blog/695756/201412/101014228535095.png) 6)点击finish完成工程项目的创建。工程项目整体结构如下: ![](http://images.cnitblog.com/blog/695756/201412/101016289159573.png) <span style="color: #0000ff;">完,</span> 转自:http://www.cnblogs.com/sonyi/p/4154797.html

2014年12月16日 · 1 分钟 · 天边的星星

Android HTTPS详解

前言 最近有一个跟Https相关的问题需要解决,因此花时间学习了一下Android平台Https的使用,同时也看了一些Https的原理,这里分享一下学习心得。 HTTPS原理 HTTPS(Hyper Text Transfer Protocol Secure),是一种基于SSL/TLS的HTTP,所有的HTTP数据都是在SSL/TLS协议封装之上进行传输的。HTTPS协议是在HTTP协议的基础上,添加了SSL/TLS握手以及数据加密传输,也属于应用层协议。所以,研究HTTPS协议原理,最终其实就是研究SSL/TLS协议。 SSL/TLS协议作用 不使用SSL/TLS的HTTP通信,就是不加密的通信,所有的信息明文传播,带来了三大风险: 窃听风险:第三方可以获知通信内容。 篡改风险:第三方可以修改通知内容。 冒充风险:第三方可以冒充他人身份参与通信。 SSL/TLS协议是为了解决这三大风险而设计的,希望达到: 所有信息都是加密传输,第三方无法窃听。 具有校验机制,一旦被篡改,通信双方都会立刻发现。 配备身份证书,防止身份被冒充。 基本的运行过程 SSL/TLS协议的基本思路是采用公钥加密法,也就是说,客户端先向服务器端索要公钥,然后用公钥加密信息,服务器收到密文后,用自己的私钥解密。但是这里需要了解两个问题的解决方案。 如何保证公钥不被篡改? 解决方法:将公钥放在数字证书中。只要证书是可信的,公钥就是可信的。 公钥加密计算量太大,如何减少耗用的时间? 解决方法:每一次对话(session),客户端和服务器端都生成一个“对话密钥”(session key),用它来加密信息。由于“对话密钥”是对称加密,所以运算速度非常快,而服务器公钥只用于加密“对话密钥”本身,这样就减少了加密运算的消耗时间。 因此,SSL/TLS协议的基本过程是这样的: 客户端向服务器端索要并验证公钥。 双方协商生成“对话密钥”。 双方采用“对话密钥”进行加密通信。 上面过程的前两布,又称为“握手阶段”。 握手阶段的详细过程 “握手阶段”涉及四次通信,需要注意的是,“握手阶段”的所有通信都是明文的。 客户端发出请求(ClientHello) 首先,客户端(通常是浏览器)先向服务器发出加密通信的请求,这被叫做ClientHello请求。在这一步中,客户端主要向服务器提供以下信息: 支持的协议版本,比如TLS 1.0版 一个客户端生成的随机数,稍后用于生成“对话密钥”。 支持的加密方法,比如RSA公钥加密。 支持的压缩方法。 这里需要注意的是,客户端发送的信息之中不包括服务器的域名。也就是说,理论上服务器只能包含一个网站,否则会分不清应用向客户端提供哪一个网站的数字证书。这就是为什么通常一台服务器只能有一张数字证书的原因。 服务器回应(ServerHello) 服务器收到客户端请求后,向客户端发出回应,这叫做ServerHello。服务器的回应包含以下内容: 确认使用的加密通信协议版本,比如TLS 1.0版本。如果浏览器与服务器支持的版本不一致,服务器关闭加密通信。 一个服务器生成的随机数,稍后用于生成“对话密钥”。 确认使用的加密方法,比如RSA公钥加密。 服务器证书。 除了上面这些信息,如果服务器需要确认客户端的身份,就会再包含一项请求,要求客户端提供“客户端证书”。比如,金融机构往往只允许认证客户连入自己的网络,就会向正式客户提供USB密钥,里面就包含了一张客户端证书。 客户端回应 客户端收到服务器回应以后,首先验证服务器证书。如果证书不是可信机构颁发,或者证书中的域名与实际域名不一致,或者证书已经过期,就会向访问者显示一个警告,由其选择是否还要继续通信。 如果证书没有问题,客户端就会从证书中取出服务器的公钥。然后,向服务器发送下面三项消息。 一个随机数。该随机数用服务器公钥加密,防止被窃听。 编码改变通知,表示随后的信息都将用双方商定的加密方法和密钥发送。 客户端握手结束通知,表示客户端的握手阶段已经结束。这一项通常也是前面发送的所有内容的hash值,用来供服务器校验。 上面第一项随机数,是整个握手阶段出现的第三个随机数,又称“pre-master key”。有了它以后,客户端和服务器就同时有了三个随机数,接着双方就用事先商定的加密方法,各自生成本次会话所用的同一把“会话密钥”。 服务器的最后回应 服务器收到客户端的第三个随机数pre-master key之后,计算生成本次会话所用的“会话密钥”。然后,向客户端最后发送下面信息。 编码改变通知,表示随后的信息都将用双方商定的加密方法和密钥发送。 服务器握手结束通知,表示服务器的握手阶段已经结束。这一项同时也是前面发生的所有内容的hash值,用来供客户端校验。 握手结束 至此,整个握手阶段全部结束。接下来,客户端与服务器进入加密通信,就完全是使用普通的HTTP协议,只不过用“会话密钥”加密内容。 服务器基于Nginx搭建HTTPS虚拟站点 之前一篇文章详细介绍了在服务器端如何生成SSL证书,并基于Nginx搭建HTTPS服务器,链接:Nginx搭建HTTPS服务器 Android实现HTTPS通信 由于各种原因吧,这里使用HttpClicent类讲解一下Android如何建立HTTPS连接。代码demo如下。 MainActivity.java ``` package com.example.photocrop; import java.io.BufferedReader; import java.io.InputStreamReader; ...

2014年12月15日 · 12 分钟 · 天边的星星

android studio 自动更新失败解决办法

自从GoogleI/O之后,很多开发者开始转向使用android studio开发项目,但是每当选择check updates的时候你总是会得到一个失败结果:Connection failed. Please check your network connection and try again 。很明显,我们生活在围城里面的人又有特殊待遇了。 网上找了一下解决办法,都说用代理,我用goagent试了一下好像不是很成功,后来发现可以配置一个更新地址来处理,方法如下: 我是用Mac OS的 , 选择你的android studio.app 显示包内容 打开Content/Info.plist 文件找到 VMOptions 在内容里面增加以下几个参数 -Djava.net.preferIPv4Stack=true -Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml -Didea.patches.url=http://dl.google.com/android/studio/patches/ 如图: 保存,如果你的android studio是开着的要重启一下。 然后检查更新,一切搞定。 如果你是Windows平台,这个文件在你android studio下面的/bin/studio.exe.vmoptions。 转载:http://www.cnblogs.com/mudoot/p/android_studio_check_updates.html Android Studio更新升级方法 自从2013 Google I/O大会之后,笔者就将android ide开发工具从eclipse迁移到Android Studio了,android studio一直在更新完善,为了与时俱进,我们当然要将工具更新到最新版本啦!其实更新本来是很简单,只要从Android Studio Help菜单中选择Check for Update即可: 但是你会收到如下提示: 小伙伴们这是为什么呢?因为“伟大的墙”!!!下面介绍笔者的解决方法。 1.获取自己电脑上安装的Android Studio 的Build Number 如果已经安装了Android Studio,那么我们只需要增量更新即可。所以下载更新jar包即可,首先要知道自己当前的Android Studio的版本号,Help-》About 注意Build #AI-130.745757,比如笔者的版本号为 130.745757 2.查询目前Android Studio的最新版本号是多少 (1)访问网站http://tools.android.com/recent可查看最新的Build Number,或者 (2)访问https://dl.google.com/android/studio/patches/updates.xml查看最新的版本号,目前笔者获得的最新xml数据如下 从返回的xml数据可知目前最新的Build Number 为132.809981 ...

2014年12月14日 · 1 分钟 · 天边的星星

android上类似与excel的效果

最近做了个项目 需要类似与excel的数据显示效果 就是最左边的已列只能上下滑动 最顶部的一行只能左右滑动!于是查了些资料做了个长的还才不多的效果 和大家分享分享! 附上demo源码 - [TestTableShow.zip](http://dl.iteye.com/topics/download/ae68552b-0d39-3015-9202-cf143b287782) (689.1 KB) 转自:http://793101503-qq-com.iteye.com/blog/1678183

2014年12月14日 · 1 分钟 · 天边的星星

Android实现类似Excel显示数据功能(支持拖动改变列宽)v 1.0

/** DemoListView @version 1.0 @author WuXx @Time 2014-08-15 / / 一、实现功能: (1)当列数较多,超过一屏时,整体视图支持左右滑动; (2)当单列数据较长,可以通过拖拽表头改变列宽; (3)为表格中每一项添加点击事件。 &nbsp; 二、效果图: <span style="color: #000000;">图片有些小。</span> 三、搭建布局: 四、主要代码: 由易到难顺序:MyOnItemClickListener、MyListView、MyAdapter (1)MyOnItemClickListener,回调函数机制。由MyAdapter调用。 **[java]** [view plain](http://blog.csdn.net/hello1234123/article/details/38590073#)[copy](http://blog.csdn.net/hello1234123/article/details/38590073#)[print](http://blog.csdn.net/hello1234123/article/details/38590073#)[?](http://blog.csdn.net/hello1234123/article/details/38590073#) <div> </div> </div> </div> - <span style="color: black;"><span style=<span class="string" style="color: blue;">&#8220;font-weight: normal;&#8221;</span>><span class="keyword" style="color: #006699;">public</span> <span class="keyword" style="color: #006699;">interface</span> MyOnItemClickListener { </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">public</span> <span class="keyword" style="color: #006699;">void</span> OnItemClickListener(View view,<span class="keyword" style="color: #006699;">int</span> line,<span class="keyword" style="color: #006699;">int</span> row,<span class="keyword" style="color: #006699;">long</span> id); </span> - <span style="color: black;">} </span> - <span style="color: black;"></span> </span> (2)MyListView,表头滑动事件,滑动事件会与HorizontalScrollView的滑动冲突,解决方案:在MotionEvent.ACTION_DOWN,设置一下HorizontalScrollView的touch不监听就好了。 **[java]** [view plain](http://blog.csdn.net/hello1234123/article/details/38590073#)[copy](http://blog.csdn.net/hello1234123/article/details/38590073#)[print](http://blog.csdn.net/hello1234123/article/details/38590073#)[?](http://blog.csdn.net/hello1234123/article/details/38590073#) <div> </div> </div> </div> - <span style="color: black;"><span style=<span class="string" style="color: blue;">&#8220;font-weight: normal;&#8221;</span>><span class="comment" style="color: #008200;">/**</span> </span> - <span style="color: black;"><span class="comment" style="color: #008200;"> * Set TouchListener on tile ,if ACTION_MOVE is called ,the listView will change its columnWidth</span> </span> - <span style="color: black;"><span class="comment" style="color: #008200;"> * */</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">private</span> <span class="keyword" style="color: #006699;">void</span> setTitleTouchListener(View v) { </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// TODO Auto-generated method stub</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">for</span>(<span class="keyword" style="color: #006699;">int</span> i=<span class="number" style="color: #c00000;"></span>;i<titles.length;i++){ </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">final</span> <span class="keyword" style="color: #006699;">int</span> column = i; </span> - <span style="color: black;"> v.findViewById(titles[i]).setOnTouchListener(<span class="keyword" style="color: #006699;">new</span> OnTouchListener() { </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">int</span> x = <span class="number" style="color: #c00000;"></span>; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">int</span> x1 = <span class="number" style="color: #c00000;"></span>; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">int</span> width = <span class="number" style="color: #c00000;"></span>; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">boolean</span> isMoved = <span class="keyword" style="color: #006699;">false</span>; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">int</span> t = <span class="number" style="color: #c00000;">20</span>; </span> - <span style="color: black;"> <span class="annotation" style="color: #646464;">@SuppressLint</span>(<span class="string" style="color: blue;">&#8220;NewApi&#8221;</span>)</span> </span> - <span style="color: black;"> <span style=<span class="string" style="color: blue;">&#8220;font-weight: normal;&#8221;</span>> <span class="annotation" style="color: #646464;">@Override</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">public</span> <span class="keyword" style="color: #006699;">boolean</span> onTouch(View v, MotionEvent event) { </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// TODO Auto-generated method stub</span> </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">//two teps</span> </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// 1.when touch down and move, change the width of head;</span> </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// 2.touch up ,change the width of the columns ;</span> </span> - <span style="color: black;"> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span> (event.getAction() == MotionEvent.ACTION_DOWN) { </span> - <span style="color: black;"> x = (<span class="keyword" style="color: #006699;">int</span>) event.getX(); </span> - <span style="color: black;"> hs.requestDisallowInterceptTouchEvent(<span class="keyword" style="color: #006699;">true</span>); </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">return</span> <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> } </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span> (event.getAction() == MotionEvent.ACTION_MOVE) { </span> - <span style="color: black;"> x1 = (<span class="keyword" style="color: #006699;">int</span>) event.getX(); </span> - <span style="color: black;"> width= v.getMeasuredWidth()+(x1-x)+t; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(t!=<span class="number" style="color: #c00000;"></span>) </span> - <span style="color: black;"> t=<span class="number" style="color: #c00000;"></span>; </span> - <span style="color: black;"> v.setLayoutParams(<span class="keyword" style="color: #006699;">new</span> LinearLayout.LayoutParams(width,v.getMeasuredHeight())); </span> - <span style="color: black;"> x = x1; </span> - <span style="color: black;"> isMoved = <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">return</span> <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> } </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(event.getAction()==MotionEvent.ACTION_UP){ </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(isMoved) </span> - <span style="color: black;"> adapter.setColumnWidth(column, width); </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">return</span> <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> </span> - <span style="color: black;"> } </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(event.getAction()==MotionEvent.ACTION_CANCEL){ </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(isMoved) </span> - <span style="color: black;"> adapter.setColumnWidth(column, width); </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">return</span> <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> } </span> - <span style="color: black;"> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">return</span> <span class="keyword" style="color: #006699;">true</span>; </span> - <span style="color: black;"> } </span> - <span style="color: black;"> }); </span> - <span style="color: black;"> } </span> - <span style="color: black;"> }</span> </span> (3)MyAdapter,这个有点小麻烦。参考SimpleAdapter来写的,不过略有不同。与SimpleAdapter重复部分不再赘述。详细内容请下载源代码看吧。 数据以及点击事件的添加,其实是很简单的。 **[java]** [view plain](http://blog.csdn.net/hello1234123/article/details/38590073#)[copy](http://blog.csdn.net/hello1234123/article/details/38590073#)[print](http://blog.csdn.net/hello1234123/article/details/38590073#)[?](http://blog.csdn.net/hello1234123/article/details/38590073#) <div> </div> </div> </div> - <span style="color: black;"><span class="keyword" style="color: #006699;">private</span> <span class="keyword" style="color: #006699;">void</span> bindView(<span class="keyword" style="color: #006699;">int</span> position, View v) { </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// TODO Auto-generated method stub</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">for</span> (<span class="keyword" style="color: #006699;">int</span> i = <span class="number" style="color: #c00000;"></span>; i < mFrom.length; i++) { </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">final</span> <span class="keyword" style="color: #006699;">int</span> line = position; </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">final</span> <span class="keyword" style="color: #006699;">int</span> row = i; </span> - <span style="color: black;"> TextView txt = (TextView) v.findViewById(mTo[i]); </span> - <span style="color: black;"> txt.setText((String) mData.get(position).get(mFrom[i])); </span> - <span style="color: black;"> txt.setOnClickListener(<span class="keyword" style="color: #006699;">new</span> OnClickListener() { </span> - <span style="color: black;"> <span class="annotation" style="color: #646464;">@Override</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">public</span> <span class="keyword" style="color: #006699;">void</span> onClick(View v) { </span> - <span style="color: black;"> <span class="comment" style="color: #008200;">// TODO Auto-generated method stub</span> </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span> (MyAdapter.<span class="keyword" style="color: #006699;">this</span>.listener != <span class="keyword" style="color: #006699;">null</span>) </span> - <span style="color: black;"> MyAdapter.<span class="keyword" style="color: #006699;">this</span>.listener.OnItemClickListener(v, line, </span> - <span style="color: black;"> row, <span class="number" style="color: #c00000;"></span>); </span> - <span style="color: black;"> } </span> - <span style="color: black;"> }); </span> - <span style="color: black;"> } </span> - <span style="color: black;"> } </span> 修改列宽,当MyListView滑动表头时修改表格主体的列宽。 **[java]** [view plain](http://blog.csdn.net/hello1234123/article/details/38590073#)[copy](http://blog.csdn.net/hello1234123/article/details/38590073#)[print](http://blog.csdn.net/hello1234123/article/details/38590073#)[?](http://blog.csdn.net/hello1234123/article/details/38590073#) <div> </div> </div> </div> - <span style="color: black;"><span class="keyword" style="color: #006699;">public</span> <span class="keyword" style="color: #006699;">void</span> setColumnWidth(<span class="keyword" style="color: #006699;">int</span> column, <span class="keyword" style="color: #006699;">int</span> width) { </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">for</span> (<span class="keyword" style="color: #006699;">int</span> i = <span class="number" style="color: #c00000;"></span>; i < viewList.size(); i++) { </span> - <span style="color: black;"> View v = viewList.get(i); </span> - <span style="color: black;"> TextView txt = (TextView) v.findViewById(mTo[column]); </span> - <span style="color: black;"> txt.setLayoutParams(<span class="keyword" style="color: #006699;">new</span> LinearLayout.LayoutParams(width, txt </span> - <span style="color: black;"> .getHeight())); </span> - <span style="color: black;"> } </span> - <span style="color: black;"> } </span> 好吧,问题来了。当使用此方法进行显示时,当你滑动表头修改列宽,你再下拉查看未显示的数据,这个时候惊喜来了,空白?嗯是的。发现有一行的部分数据项是空白的,当你继续下拉,你会发现这个空白会循环的出现在你屏幕上,也许你猜到了这其中的原因。我们可以举一个例子,假如你的ListView第一次加载出来,屏幕上显示的item数量为23个,但是,getView调用了24次,当然,我这么说是不负责的,好吧,准确的说是生成了24个View(就是你的item),why 24?因为有一个影藏的。第24个View的产生是因为安卓内部有一个recycler机制,实现了View的循环使用,显而易见,23个是无法实现循环的。这里我借鉴网上的一张图,大家就一目了然了。 这时,聪明的你发现了,我们没有涉及到如何在getView中找出影藏的View。其实这个问题我也没有特别好的解决方案,目前我采取的方案,可以在把空白问题出现的概率控制在比较小的范围。这种方案是通过5、6次调试通过log日志得出的,有一定的局限性。 通过getView给出的参数,position、parent以及用来存储视图的ViewList,进行判断影藏的View。代码如下: **[java]** [view plain](http://blog.csdn.net/hello1234123/article/details/38590073#)[copy](http://blog.csdn.net/hello1234123/article/details/38590073#)[print](http://blog.csdn.net/hello1234123/article/details/38590073#)[?](http://blog.csdn.net/hello1234123/article/details/38590073#) <div> </div> </div> </div> - <span style="color: black;"><span class="keyword" style="color: #006699;">if</span>(lastViewsSize==viewList.size()){ </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(position!=<span class="number" style="color: #c00000;"></span>){ </span> - <span style="color: black;"> <span class="keyword" style="color: #006699;">if</span>(position==parent.getChildCount()&&position==viewList.size()-<span class="number" style="color: #c00000;">1</span>){ </span> - <span style="color: black;"> setWidth(v); </span> - <span style="color: black;"> } </span> - <span style="color: black;"> } </span> - <span style="color: black;"> }<span class="keyword" style="color: #006699;">else</span> { </span> - <span style="color: black;"> lastViewsSize = viewList.size(); </span> - <span style="color: black;"> } </span> 大概描述一下: 首先申明,当ListView在一个屏幕上显示23个时,它并不只是调用24次Adapter的getView,正常情况应该是23(或者说是24,这个值我不能确定)的3、4倍,为什么有这么多呢?其中有一次是用于确定布局的宽度和高度用于draw的,其他的我不清楚。 但是,可以确定当最后一次调用getView时是用于显示的,我们如何确定这一次呢,通过log日志可以看出,此时viewList.size()已经为常值,所以第一个判断条件便是如此产生的,当然我们需要排除掉position为0的干扰,最后我们找出我们影藏的View,然后setWidth,游戏就这样结束了。我觉得有必要把调试过程中log日志也贴出来: 源代码:http://download.csdn.net/detail/hello1234123/7765011 &nbsp; 转自:http://blog.csdn.net/hello1234123/article/details/38590073

2014年12月14日 · 6 分钟 · 天边的星星

Android开源项目第五篇——优秀个人和团体篇

本文为那些不错的Android开源项目第五篇——优秀个人和团体篇,主要介绍那些乐于分享并且有一些很不错的开源项目的个人和组织(公司) 最新内容请访问[AndroidOpenProject@Github](https://github.com/Trinea/android-open-project),欢迎Star和Fork。 对你有帮助的话,去知乎点个赞让更多人了解:Android 优秀开源项目及特效推荐。 Android开源项目系列汇总已完成,包括: [Android开源项目第一篇——个性化控件(View)篇](http://www.trinea.cn/android/android-open-source-projects-view/) Android开源项目第二篇——工具库篇 Android开源项目第三篇——优秀项目篇 Android开源项目第四篇——开发及测试工具篇 Android开源项目第五篇——优秀个人和团体篇 Follow大神,深挖大神的项目和following,你会发现很多。长期更新,欢迎大家补充和推荐^_^ **一、个人** **1. JakeWharton 就职于Square** Github地址:https://github.com/JakeWharton 代表作:ActionBarSherlock,Android-ViewPagerIndicator,Nine Old Androids,SwipeToDismissNOA,hugo,butterknife,Android-DirectionalViewPager pidcat另外对square及其他开源项目有很多贡献 博客:http://jakewharton.com/ 绝对牛逼的大神,项目主要集中在Android版本兼容,ViewPager及开发工具上. **2. Chris Banes** Github地址:https://github.com/chrisbanes 代表作:ActionBar-PullToRefresh,PhotoView,Android-BitmapCache,Android-PullToRefresh 博客:http://chris.banes.me/ **3. Koushik Dutta就职于ClockworkMod** Github地址:https://github.com/koush 代表作:Superuser,AndroidAsync,UrlImageViewHelper,ion, 另外对https://github.com/CyanogenMod的开源项目有很多贡献 博客:[http://koush.com/](http://koush.com/) **4. Simon Vig** Github地址:https://github.com/SimonVT 代表作:android-menudrawer,MessageBar 博客:[http://simonvt.net/](http://simonvt.net/) **5. Manuel Peinado** Github地址:https://github.com/ManuelPeinado 代表作:FadingActionBar,GlassActionBar,RefreshActionItem,QuickReturnHeader **6. Emil Sjölander** Github地址:https://github.com/emilsjolander 代表作:StickyListHeaders,sprinkles,android-FlipView 博客:[http://emilsjolander.se/](http://emilsjolander.se/) **7. greenrobot** Github地址:https://github.com/greenrobot 代表作:greenDAO,EventBus 网址:http://greenrobot.de/ ...

2014年12月14日 · 1 分钟 · 天边的星星

Android开源项目第四篇——开发及测试工具篇

本文为那些不错的Android开源项目第四篇——开发工具篇,主要介绍Android开发工具和测试工具相关的开源项目。 最新内容请访问[AndroidOpenProject@Github](https://github.com/Trinea/android-open-project),欢迎Star和Fork。 对你有帮助的话,去知乎点个赞让更多人了解:Android 优秀开源项目及特效推荐。 Android开源项目系列汇总已完成,包括: [Android开源项目第一篇——个性化控件(View)篇](http://www.trinea.cn/android/android-open-source-projects-view/) Android开源项目第二篇——工具库篇 Android开源项目第三篇——优秀项目篇 Android开源项目第四篇——开发及测试工具篇 Android开源项目第五篇——优秀个人和团体篇 **1、Buck** facebook开源的Android编译工具,效率是ant的两倍。主要优点在于: (1) 加快编译速度,通过并行利用多核cpu和跟踪不变资源减少增量编译时间实现 (2) 可以在编译系统中生成编译规则而无须另外的系统生成编译规则文件 (3) 编译同时可生成单元测试结果 (4) 既可用于IDE编译也可用于持续集成编译 (5) facebook持续优化中 项目地址:https://github.com/facebook/buck **2、Android Maven Plugin** Android Maven插件,可用于对android三方依赖进行管理。在J2EE开发中,maven是非常成熟的依赖库管理工具,可统一管理依赖库。 项目地址:https://github.com/jayway/maven-android-plugin **3、Spoon** 可用于android不同机型设备自动化测试,能将应用apk和测试apk运行在不同机器上并生成相应测试报告。 项目地址:https://github.com/square/spoon **4、Android FEST** 提供一些列方便的断言,可用于提高编写Android自测代码效率 项目地址:https://github.com/square/fest-android **5、SelectorChapek for Android** Android Studio插件,可根据固定文件名格式资源自动生成drawable selectors xml文件。 项目地址:https://github.com/inmite/android-selector-chapek **6、Android Resource Navigator** chrome插件,可以方便的查看github上android源码工程的styles.xml和themes.xml。主要功能: (1) 快速打开android styles.xml themes.xml (2) 方便在资源间跳转。styles.xml themes.xml文件中资源链接跳转,可以方便跳转到某个资源 (3) 方便查找某个style和theme。chrome地址栏输入arn+tab+搜索内容回车即可 (4) 自动下载不同分辨率下的drawable (5) 通过映射查找那些不是按照固定命名规则命名的style和theme 项目地址:https://github.com/jgilfelt/android-resource-navigator 示例:https://chrome.google.com/webstore/detail/android-resource-navigato/agoomkionjjbejegcejiefodgbckeebo?hl=en&gl=GB ...

2014年12月14日 · 1 分钟 · 天边的星星

Android开源项目第三篇——优秀项目篇

本文为那些不错的Android开源项目第三篇——优秀项目篇,主要介绍那些还不错的完整Android项目。 最新内容请访问[AndroidOpenProject@Github](https://github.com/Trinea/android-open-project),欢迎Star和Fork。 对你有帮助的话,去知乎点个赞让更多人了解:Android 优秀开源项目及特效推荐。 Android开源项目系列汇总已完成,包括: [Android开源项目第一篇——个性化控件(View)篇](http://www.trinea.cn/android/android-open-source-projects-view/) Android开源项目第二篇——工具库篇 Android开源项目第三篇——优秀项目篇 Android开源项目第四篇——开发及测试工具篇 Android开源项目第五篇——优秀个人和团体篇 记录的项目主要依据是项目有意思或项目分层规范比较好。 **Linux** 项目地址:https://github.com/torvalds/linux **Android** 项目地址:https://android.googlesource.com/或https://github.com/android 以上两个项目,不解释 **(1) ZXing 二维码扫描工具** 项目地址:https://github.com/zxing/zxing或https://code.google.com/p/zxing/ APK地址:https://play.google.com/store/apps/details?id=com.google.zxing.client.android PS:现在市面上很多应用的二维码扫描功能都是从这个修改而来 **(2) photup 编辑机批量上传照片到facebook上** 项目地址:https://github.com/chrisbanes/photup APK地址:https://play.google.com/store/apps/details?id=uk.co.senab.photup PS:代码分包合理,很棒。不过这个项目依赖的开源项目比较多,比较难编译 ![android photo up image process](http://farm4.staticflickr.com/3694/11100968474_75ab4fbd56_o.jpg) **(3) Github的Android客户端项目** 项目地址:https://github.com/github/android APK地址:https://play.google.com/store/apps/details?id=com.github.mobile **(4) MIUI便签** 项目地址:https://github.com/MiCode/Notes APK地址:https://github.com/Trinea/TrineaDownload/blob/master/miui-note-demo.apk?raw=true PS:项目分包比较合理,相比较miui的文件管理器https://github.com/MiCode/FileExplorer代码规范较好得多 **(5) 四次元-新浪微博客户端** 项目地址:https://github.com/qii/weiciyuan APK地址:https://play.google.com/store/apps/details?id=org.qii.weiciyuan **(6) gnucash-一个记账理财软件** 项目地址:https://github.com/codinguser/gnucash-android APK地址:http://play.google.com/store/apps/details?id=org.gnucash.android **(7) AntennaPod支持rss订阅、音乐订阅** 项目地址:https://github.com/danieloeh/AntennaPod APK地址:https://play.google.com/store/apps/details?id=de.danoeh.antennapod ...

2014年12月14日 · 1 分钟 · 天边的星星

Android开源项目第二篇——工具库篇

本文为那些不错的Android开源项目第二篇——开发工具库篇,主要介绍常用的开发库,包括依赖注入框架、图片缓存、网络相关、数据库ORM建模、Android公共库、Android 高版本向低版本兼容、多媒体相关及其他。 最新内容请访问[AndroidOpenProject@Github](https://github.com/Trinea/android-open-project),欢迎Star和Fork。 对你有帮助的话,去知乎点个赞让更多人了解:[Android 优秀开源项目及特效推荐](http://www.zhihu.com/question/19804692/answer/21890050)。 Android开源项目系列汇总已完成,包括: [Android开源项目第一篇——个性化控件(View)篇](http://www.trinea.cn/android/android-open-source-projects-view/) [Android开源项目第二篇——工具库篇](http://www.trinea.cn/android/android-open-source-projects-dev-lib/) [Android开源项目第三篇——优秀项目篇](http://www.trinea.cn/android/android-open-source-projects-excellent-project/) [Android开源项目第四篇——开发及测试工具篇](http://www.trinea.cn/android/android-open-source-projects-dev-tool/) [Android开源项目第五篇——优秀个人和团体篇](http://www.trinea.cn/android/android-open-source-projects-excellent-personal-group/) 通过这些项目你可以大幅度减少不必要的开发而将精力放在更重要的地方。 **一、依赖注入DI** 通过依赖注入减少View、服务、资源简化初始化,事件绑定等重复繁琐工作 **1. AndroidAnnotations(Code Diet) android快速开发框架** 项目地址:[https://github.com/excilys/androidannotations](https://github.com/excilys/androidannotations) 文档介绍:[https://github.com/excilys/androidannotations/wiki](https://github.com/excilys/androidannotations/wiki) 官方网站:[http://androidannotations.org/](http://androidannotations.org/) 特点:(1)依赖注入:包括view,extras,系统服务,资源等等 (2)简单的线程模型,通过annotation表示方法运行在ui线程还是后台线程 (3)事件绑定:通过annotation表示view的响应事件,不用在写内部类 (4)REST客户端:定义客户端接口,自动生成REST请求的实现 (5)没有你想象的复杂:AndroidAnnotations只是在在编译时生成相应子类 (6)不影响应用性能:仅50kb,在编译时完成,不会对运行时有性能影响。 PS:与roboguice的比较:roboguice通过运行时读取annotations进行反射,所以可能影响应用性能,而AndroidAnnotations在编译时生成子类,所以对性能没有影响 **2. roboguice 帮你处理了很多代码异常,利用annotation使得更少的代码完成项目** 项目地址:[https://github.com/roboguice/roboguice](https://github.com/roboguice/roboguice) 文档介绍:[https://github.com/roboguice/roboguice/wiki](https://github.com/roboguice/roboguice/wiki) **3. butterknife 利用annotation帮你快速完成View的初始化,减少代码** 项目地址:[https://github.com/JakeWharton/butterknife](https://github.com/JakeWharton/butterknife) 文档介绍:[http://jakewharton.github.io/butterknife/](http://jakewharton.github.io/butterknife/) **4. Dagger 依赖注入,适用于Android和Java** 项目地址:[https://github.com/square/dagger](https://github.com/square/dagger) 文档介绍:[http://square.github.io/dagger/](http://square.github.io/dagger/) **二、图片缓存** **1. Android-Universal-Image-Loader 图片缓存** 目前使用最广泛的图片缓存,支持主流图片缓存的绝大多数特性。 项目地址:[https://github.com/nostra13/Android-Universal-Image-Loader](https://github.com/nostra13/Android-Universal-Image-Loader) Demo地址:[https://github.com/Trinea/TrineaDownload/blob/master/universal-imageloader-demo.apk?raw=true](https://github.com/Trinea/TrineaDownload/blob/master/universal-imageloader-demo.apk?raw=true) 文档介绍:[http://www.intexsoft.com/blog/item/74-universal-image-loader-part-3.html](http://www.intexsoft.com/blog/item/74-universal-image-loader-part-3.html) **2. picasso square开源的图片缓存** 项目地址:[https://github.com/square/picasso](https://github.com/square/picasso) 文档介绍:[http://square.github.io/picasso/](http://square.github.io/picasso/) 特点:(1)可以自动检测adapter的重用并取消之前的下载 (2)图片变换 (3)可以加载本地资源 (4)可以设置占位资源 (5)支持debug模式 **3. ImageCache 图片缓存,包含内存和Sdcard缓存** 项目地址:[https://github.com/Trinea/AndroidCommon](https://github.com/Trinea/AndroidCommon) Demo地址:[https://play.google.com/store/apps/details?id=cn.trinea.android.demo](https://play.google.com/store/apps/details?id=cn.trinea.android.demo) 文档介绍:[http://www.trinea.cn/?p=704](http://www.trinea.cn/?p=704) 特点:(1)支持预取新图片,支持等待队列 (2)包含二级缓存,可自定义文件名保存规则 (3)可选择多种缓存算法(FIFO、LIFO、LRU、MRU、LFU、MFU等13种)或自定义缓存算法 (4)可方便的保存及初始化恢复数据 (5)支持不同类型网络处理 (6)可根据系统配置初始化缓存等 **三、网络相关** **1. Asynchronous Http Client for Android Android异步Http请求** 项目地址:[https://github.com/loopj/android-async-http](https://github.com/loopj/android-async-http) 文档介绍:[http://loopj.com/android-async-http/](http://loopj.com/android-async-http/) 特点:(1) 在匿名回调中处理请求结果 (2) 在UI线程外进行http请求 (3) 文件断点上传 (4) 智能重试 (5) 默认gzip压缩 (6) 支持解析成Json格式 (7) 可将Cookies持久化到SharedPreferences **2. android-query 异步加载,更少代码完成Android加载** 项目地址:[https://github.com/androidquery/androidquery](https://github.com/androidquery/androidquery)或[https://code.google.com/p/android-query/](https://code.google.com/p/android-query/) 文档介绍:[https://code.google.com/p/android-query/#Why_AQuery](https://code.google.com/p/android-query/#Why_AQuery)? Demo地址:[https://play.google.com/store/apps/details?id=com.androidquery](https://play.google.com/store/apps/details?id=com.androidquery) 特点:[https://code.google.com/p/android-query/#Why_AQuery](https://code.google.com/p/android-query/#Why_AQuery)? **3. Async Http Client Java异步Http请求** 项目地址:[https://github.com/AsyncHttpClient/async-http-client](https://github.com/AsyncHttpClient/async-http-client) 文档介绍:[http://sonatype.github.io/async-http-client/](http://sonatype.github.io/async-http-client/) **4. Ion 支持图片、json、http post等异步请求** 项目地址:[https://github.com/koush/ion](https://github.com/koush/ion) 文档介绍:[https://github.com/koush/ion#more-examples](https://github.com/koush/ion#more-examples) **5. HttpCache Http缓存** 项目地址:[https://github.com/Trinea/AndroidCommon](https://github.com/Trinea/AndroidCommon) Demo地址:[https://play.google.com/store/apps/details?id=cn.trinea.android.demo](https://play.google.com/store/apps/details?id=cn.trinea.android.demo) Demo代码:[https://github.com/Trinea/AndroidDemo/blob/master/src/cn/trinea/android/demo/HttpCacheDemo.java](https://github.com/Trinea/AndroidDemo/blob/master/src/cn/trinea/android/demo/HttpCacheDemo.java) 特点是:(1) 根据cache-control、expires缓存http请求 (2) 支持同步、异步Http请求 (3) 在匿名回调中处理请求结果 (4) 在UI线程外进行http请求 (5) 默认gzip压缩 **6. Http Request** 项目地址:[https://github.com/kevinsawicki/http-request](https://github.com/kevinsawicki/http-request) 文档介绍:[https://github.com/kevinsawicki/http-request#examples](https://github.com/kevinsawicki/http-request#examples) **7. okhttp square开源的http工具类** 项目地址:[https://github.com/square/okhttp](https://github.com/square/okhttp) 文档介绍:[http://square.github.io/okhttp/](http://square.github.io/okhttp/) 特点:(1) 支持SPDY([http://zh.wikipedia.org/wiki/SPDY)协议。SPDY协议是Google开发的基于传输控制协议的应用层协议,通过压缩,多路复用(一个TCP链接传送网页和图片等资源](http://zh.wikipedia.org/wiki/SPDY)%E5%8D%8F%E8%AE%AE%E3%80%82SPDY%E5%8D%8F%E8%AE%AE%E6%98%AFGoogle%E5%BC%80%E5%8F%91%E7%9A%84%E5%9F%BA%E4%BA%8E%E4%BC%A0%E8%BE%93%E6%8E%A7%E5%88%B6%E5%8D%8F%E8%AE%AE%E7%9A%84%E5%BA%94%E7%94%A8%E5%B1%82%E5%8D%8F%E8%AE%AE%EF%BC%8C%E9%80%9A%E8%BF%87%E5%8E%8B%E7%BC%A9%EF%BC%8C%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8(%E4%B8%80%E4%B8%AATCP%E9%93%BE%E6%8E%A5%E4%BC%A0%E9%80%81%E7%BD%91%E9%A1%B5%E5%92%8C%E5%9B%BE%E7%89%87%E7%AD%89%E8%B5%84%E6%BA%90))和优先级来缩短加载时间。 (2) 如果SPDY不可用,利用连接池减少请求延迟 (3) Gzip压缩 (4) Response缓存减少不必要的请求 **8. Retrofit RESTFUL API设计** 项目地址:[https://github.com/square/retrofit](https://github.com/square/retrofit) 文档介绍:[http://square.github.io/retrofit/](http://square.github.io/retrofit/) **四、数据库 orm工具包** orm的db工具类,简化建表、查询、更新、插入、事务、索引的操作 **1. greenDAO Android Sqlite orm的db工具类** 项目地址:[https://github.com/greenrobot/greenDAO](https://github.com/greenrobot/greenDAO) 文档介绍:[http://greendao-orm.com/documentation/](http://greendao-orm.com/documentation/) 官方网站:[http://greendao-orm.com/](http://greendao-orm.com/) 特点:(1)性能佳 (2) 简单易用的API (3) 内存小好小 (4) 库大小小 **2. ActiveAndroid Android Sqlite orm的db工具类** 项目地址:[https://github.com/pardom/ActiveAndroid](https://github.com/pardom/ActiveAndroid) 文档介绍:[https://github.com/pardom/ActiveAndroid/wiki/_pages](https://github.com/pardom/ActiveAndroid/wiki/_pages) **3. Sprinkles Android Sqlite orm的db工具类** 项目地址:[https://github.com/emilsjolander/sprinkles](https://github.com/emilsjolander/sprinkles) 文档介绍:[http://emilsjolander.github.io/blog/2013/12/18/android-with-sprinkles/](http://emilsjolander.github.io/blog/2013/12/18/android-with-sprinkles/) 特点:比较显著的特点就是配合[https://github.com/square/retrofit](https://github.com/square/retrofit)能保存从服务器获取的数据 **五、Android公共库** **1. Guava Google的基于java1.6的类库集合的扩展项目** 包括collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O等等. 这些高质量的API可以使你的JAVa代码更加优雅,更加简洁 项目地址:[https://code.google.com/p/guava-libraries/](https://code.google.com/p/guava-libraries/) 文档介绍:[https://code.google.com/p/guava-libraries/wiki/GuavaExplained](https://code.google.com/p/guava-libraries/wiki/GuavaExplained) **2. AndroidCommon Android公共库** 项目地址:[https://github.com/Trinea/AndroidCommon](https://github.com/Trinea/AndroidCommon) Demo地址:[https://play.google.com/store/apps/details?id=cn.trinea.android.demo](https://play.google.com/store/apps/details?id=cn.trinea.android.demo) 文档介绍:[http://www.trinea.cn/?p=778](http://www.trinea.cn/?p=778) 包括:(1)缓存(图片缓存、预取缓存、网络缓存) (2) 公共View(下拉及底部加载更多ListView、底部加载更多ScrollView、滑动一页Gallery) (3) Android常用工具类(网络、下载、Android资源操作、shell、文件、Json、随机数、Collection等等) **六、Android 高版本向低版本兼容** **1. ActionBarSherlock 为Android所有版本提供统一的ActionBar,解决4.0以下ActionBar的适配问题** 项目地址:[https://github.com/JakeWharton/ActionBarSherlock](https://github.com/JakeWharton/ActionBarSherlock) Demo地址:[https://play.google.com/store/apps/details?id=com.actionbarsherlock.sample.demos](https://play.google.com/store/apps/details?id=com.actionbarsherlock.sample.demos) APP示例:太多了。。现在连google都在用 **2. Nine Old Androids 将Android 3.0(Honeycomb)所有动画API(ObjectAnimator ValueAnimator等)兼容到Android1.0** 项目地址:[https://github.com/JakeWharton/NineOldAndroids](https://github.com/JakeWharton/NineOldAndroids) Demo地址:[https://play.google.com/store/apps/details?id=com.jakewharton.nineoldandroids.sample](https://play.google.com/store/apps/details?id=com.jakewharton.nineoldandroids.sample) 文档介绍:[http://nineoldandroids.com/](http://nineoldandroids.com/) **3. HoloEverywhere 将Android 3.0的Holo主题兼容到Android2.1++** 项目地址:[https://github.com/Prototik/HoloEverywhere](https://github.com/Prototik/HoloEverywhere) Demo地址:[https://raw.github.com/Prototik/HoloEverywhere/repo/org/holoeverywhere/demo/2.1.0/demo-2.1.0.apk](https://raw.github.com/Prototik/HoloEverywhere/repo/org/holoeverywhere/demo/2.1.0/demo-2.1.0.apk) 文档介绍:[http://android-developers.blogspot.com/2012/01/holo-everywhere.html](http://android-developers.blogspot.com/2012/01/holo-everywhere.html) **七、多媒体相关** **1. cocos2d-x 跨平台的2d游戏框架,支持Android、IOS、Linux、Windows等众多平台** 项目地址:[https://github.com/cocos2d/cocos2d-x](https://github.com/cocos2d/cocos2d-x) 文档介绍:[http://www.cocos2d-x.org/wiki](http://www.cocos2d-x.org/wiki) 官方网站:[http://www.cocos2d-x.org/](http://www.cocos2d-x.org/) **2. Vitamio 是一款Android与iOS平台上的全能多媒体开发框架** 项目地址:[https://github.com/yixia/VitamioBundle](https://github.com/yixia/VitamioBundle) 网站介绍:[http://www.vitamio.org/docs/](http://www.vitamio.org/docs/) 特点:(1) 全面支持硬件解码与GPU渲染 (2) 能够流畅播放720P甚至1080P高清MKV,FLV,MP4,MOV,TS,RMVB等常见格式的视频 (3) 在Android与iOS上跨平台支持 MMS, RTSP, RTMP, HLS(m3u8)等常见的多种视频流媒体协议,包括点播与直播。 **3. PhotoProcessing 利用ndk处理图片库**,支持Instafix、Ansel、Testino、XPro、Retro、BW、Sepia、Cyano、Georgia、Sahara、HDR、Rotate、Flip 项目地址:[https://github.com/lightbox/PhotoProcessing](https://github.com/lightbox/PhotoProcessing) Demo地址:[https://github.com/Trinea/TrineaDownload/blob/master/photo-processing.apk?raw=true](https://github.com/Trinea/TrineaDownload/blob/master/photo-processing.apk?raw=true) **4. Android StackBlur 图片模糊效果工具类** 项目地址:[https://github.com/kikoso/android-stackblur](https://github.com/kikoso/android-stackblur) Demo地址:[https://github.com/kikoso/android-stackblur/blob/master/StackBlurDemo/bin/StackBlurDemo.apk?raw=true](https://github.com/kikoso/android-stackblur/blob/master/StackBlurDemo/bin/StackBlurDemo.apk?raw=true) 文档介绍:[https://github.com/kikoso/android-stackblur#usage](https://github.com/kikoso/android-stackblur#usage) **八、其他** **1. Salvage view 带View缓存的Viewpager PagerAdapter,很方便使用** 项目地址:[https://github.com/JakeWharton/salvage](https://github.com/JakeWharton/salvage) **2. Android-PasscodeLock 应用锁**,每次启动或从任何Activity启动应用都需要输入四位数字的密码方可进入 项目地址:[https://github.com/wordpress-mobile/Android-PasscodeLock](https://github.com/wordpress-mobile/Android-PasscodeLock) Demo地址:[https://play.google.com/store/apps/details?id=com.sothree.umano](https://play.google.com/store/apps/details?id=com.sothree.umano) APP示例:Wordpress Android,支付宝,挖财 **3. android-lockpattern Android的图案密码解锁** 项目地址:[https://code.google.com/p/android-lockpattern/](https://code.google.com/p/android-lockpattern/) Demo地址:[https://play.google.com/store/apps/details?id=group.pals.android.lib.ui.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](https://code.google.com/p/android-lockpattern/wiki/QuickUse) 示例APP:Android开机的图案密码解锁,支付宝的密码解锁 **4. GlowPadBackport将Android4.2的锁屏界面解锁扩展到Android1.6及1.6+** 项目地址:[https://github.com/rock3r/GlowPadBackport](https://github.com/rock3r/GlowPadBackport) Demo地址:[https://play.google.com/store/apps/details?id=net.sebastianopoggi.samples.ui.GlowPadSample](https://play.google.com/store/apps/details?id=net.sebastianopoggi.samples.ui.GlowPadSample) 效果图:[https://lh6.ggpht.com/U070b6Lh6cVsVwx4jN-5nq0xqiB1PBzrYABPeJIEe2hZQ5UWOxc-FDUG77wADelToHA=h310-rw](https://lh6.ggpht.com/U070b6Lh6cVsVwx4jN-5nq0xqiB1PBzrYABPeJIEe2hZQ5UWOxc-FDUG77wADelToHA=h310-rw) **5. GlowPadView Android4锁屏界面解锁** 项目地址:[https://github.com/nadavfima/GlowPadView](https://github.com/nadavfima/GlowPadView) 效果图:[https://raw.github.com/nadavfima/GlowPadView/master/example.png](https://raw.github.com/nadavfima/GlowPadView/master/example.png) **6. Android Priority Job Queue Android后台任务队列** 项目地址:[https://github.com/path/android-priority-jobqueue](https://github.com/path/android-priority-jobqueue) 文档介绍:[https://github.com/path/android-priority-jobqueue#getting-started](https://github.com/path/android-priority-jobqueue#getting-started) **7. jsoup 一个解析html的java库,可方便的提取和操作数据** 项目地址:[https://github.com/jhy/jsoup](https://github.com/jhy/jsoup) 官方网站:[http://jsoup.org/](http://jsoup.org/) 作用:(1) 从一个url、文件或string获得html并解析 (2) 利用dom遍历或css选择器查找、提取数据 (3) 操作html元素 (4) 根据白名单去除用于提交的非法数据防止xss攻击 (5) 输出整齐的html **8.ZIP java压缩和解压库** 项目地址:[https://github.com/zeroturnaround/zt-zip](https://github.com/zeroturnaround/zt-zip) 文档介绍:[https://github.com/zeroturnaround/zt-zip#examples](https://github.com/zeroturnaround/zt-zip#examples) 作用:(1) 解压和压缩,并支持文件夹内递归操作 (2) 支持包含和排除某些元素 (3) 支持重命名元素 (4) 支持遍历zip包内容 (5) 比较两个zip包等功能 **9. Cobub Razor 开源的mobile行为分析系统**,包括web端、android端,支持ios和window phone 项目地址:[https://github.com/cobub/razor](https://github.com/cobub/razor) Demo地址:[http://demo.cobub.com/razor](http://demo.cobub.com/razor) 网站介绍:[http://dev.cobub.com/](http://dev.cobub.com/) **10. aFileChooser 文件选择器**,可内嵌到程序中,而无需使用系统或三方文件选择器。 项目地址:[https://github.com/iPaulPro/aFileChooser](https://github.com/iPaulPro/aFileChooser) **11. androidpn 基于xmpp协议的消息推送解决方案**,包括服务器端和android端。 项目地址:[https://github.com/dannytiehui/androidpn](https://github.com/dannytiehui/androidpn) **12. Android插件式开发** 项目地址:[https://github.com/umeng/apf](https://github.com/umeng/apf)

2014年12月14日 · 2 分钟 · 天边的星星

Android开源项目第一篇——个性化控件(View)篇

本文为那些不错的Android开源项目第一篇——个性化控件(View)篇,主要介绍Android上那些不错个性化的View,包括ListView、ActionBar、Menu、ViewPager、Gallery、GridView、ImageView、ProgressBar及其他如Dialog、Toast、EditText、TableView、Activity Animation等等。 最新内容请访问[AndroidOpenProject@Github](https://github.com/Trinea/android-open-project),欢迎Star和Fork。 对你有帮助的话,去知乎点个赞让更多人了解:[Android 优秀开源项目及特效推荐](http://www.zhihu.com/question/19804692/answer/21890050)。 Android开源项目系列汇总已完成,包括: [Android开源项目第一篇——个性化控件(View)篇](http://www.trinea.cn/android/android-open-source-projects-view/) Android开源项目第二篇——工具库篇 Android开源项目第三篇——优秀项目篇 Android开源项目第四篇——开发及测试工具篇 Android开源项目第五篇——优秀个人和团体篇 本文中你可以找到那些精美App中各种有特性的View,如Gmail的左滑出菜单、Google plus的卡片式ListView,Pinterest的瀑布流,微信的左滑删除,微博的个页面下拉刷新等等。长期更新,欢迎大家补充和推荐^_^ **一、ListView** **1. android-pulltorefresh 一个强大的拉动刷新开源项目,支持各种控件下拉刷新** ListView、ViewPager、WevView、ExpandableListView、GridView、(Horizontal )ScrollView、Fragment上下左右拉动刷新,比下面johannilsson那个只支持ListView的强大的多。并且他实现的下拉刷新ListView在item不足一屏情况下也不会显示刷新提示,体验更好。 项目地址:https://github.com/chrisbanes/Android-PullToRefresh Demo地址:https://github.com/Trinea/TrineaDownload/blob/master/pull-to-refreshview-demo.apk?raw=true APP示例:新浪微博各个页面 **2. android-pulltorefresh-listview 下拉刷新ListView** 项目地址:https://github.com/johannilsson/android-pulltorefresh Demo地址:https://github.com/Trinea/TrineaDownload/blob/master/pull-to-refresh-listview-demo.apk?raw=true PS:这个被很多人使用的项目实际有不少bug,推荐使用上面的android-pulltorefresh **3. DropDownListView 下拉刷新及滑动到底部加载更多ListView** 项目地址:https://github.com/Trinea/AndroidCommon Demo地址:https://github.com/Trinea/TrineaDownload/blob/master/TrineaAndroidDemo.apk?raw=true 文档介绍:http://www.trinea.cn/?p=523 **4. DragSortListView 拖动排序的ListView** 同时支持ListView滑动item删除,各个Item高度不一、单选、复选、CursorAdapter做为适配器、拖动背景变化等 项目地址:https://github.com/bauerca/drag-sort-listview Demo地址:https://play.google.com/store/apps/details?id=com.mobeta.android.demodslv APP示例:Wordpress Android **5. SwipeListView 支持定义ListView左右滑动事件,支持左右滑动位移,支持定义动画时间** 项目地址:https://github.com/47deg/android-swipelistview Demo地址:https://play.google.com/store/apps/details?id=com.fortysevendeg.android.swipelistview APP示例:微信 **6. Android-SwipeToDismiss 滑动Item消失ListView** 项目地址:https://github.com/romannurik/Android-SwipeToDismiss 支持3.0以下版本见:https://github.com/JakeWharton/SwipeToDismissNOA Demo地址:https://github.com/JakeWharton/SwipeToDismissNOA/SwipeToDismissNOA.apk/qr_code **7. StickyListHeaders GroupName滑动到顶端时会固定不动直到另外一个GroupName到达顶端的ExpandListView,支持快速滑动,支持Android2.3及以上** 项目地址:[https://github.com/emilsjolander/StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) APP示例:Android 4.0联系人 效果图:[https://raw.github.com/emilsjolander/StickyListHeaders/master/demo.gif](https://raw.github.com/emilsjolander/StickyListHeaders/master/demo.gif) **8. pinned-section-listview GroupName滑动到顶端时会固定不动直到另外一个GroupName到达顶端的ExpandListView** 项目地址:https://github.com/beworker/pinned-section-listview 效果图:https://raw.github.com/beworker/pinned-section-listview/master/screen1.png ...

2014年12月14日 · 3 分钟 · 天边的星星