Blog Articles
-
APP中时间处理
1.获取系统时间//Returns the current time in milliseconds since January 1, 1970 00:00:00.0 UTC. System.currentTimeMillis();获取自系统启动以后的毫秒值(**不包括**深度睡眠时间) SystemClock.uptimeMillis();获取自系统启动以后的毫秒值(**包括**深度睡眠时间) S
Published on: -
蒙板引导页面
一、引导页面的弹出 使用FrameLayout: 查找到contentview的父亲,是一个FrameLayout类型的布局文件,id为android:id/content。在这个FrameLayout的最上层插入引导view,即可实现引导功能。 示例代码: FrameLayout frameLayout=(FrameLayout)getActivity().findViewById
Published on: -
Android 使用 sendevent 模拟鼠标和键盘事件
这篇文章是从网络整理的。 模拟原理是对驱动发送消息,就是linux里面的input子系统。 命令格式: sendevent /dev/input/eventX [type] [key] [value] 其中/dev/input/eventX 对应的是设备,可以用getevent查看可用设备。 type,key,value这些定义在linux源代码里面的input.h文件里面。 例:
Published on: -
API21 以下使用 material design 风格的alertdialog
1.使用第三方库,如 https://github.com/fengdai/AlertDialogPro 2.使用兼容库的主题 修改values/style.xml ,设置如下: name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> name="alertDialogTheme">@style/Ap
Published on: -
APP使用QQ登录
注册腾讯开放平台,并上传应用通过审核 下载SDK: http://wiki.open.qq.com/wiki/mobile/SDK下载 因为只用到QQ登录,所以只要下载基础包就OK了。 代码集成: 在AndroidManifest.xml中,加入:
Published on: -
gridview 让子项充满
要让子项充満GridView,需要重新调整GridView中子项的高度,网上有人在Adapter里面调整,但是我这里试过不行,原因不清楚。 android中画view有两大流程,measure和draw,因为在measure的时候,我们还没法知道具体的宽高,所以只有在draw之前根据gridview的高度和子项的行数,重新设置子项的高度。 于是我继承GridView,重写dis
Published on: -
Action Bar (1)
action bar是一个标示用户位置的窗口功能,可以提供用户操作和导航模式。使用action bar可以为用户提供熟悉的界面(如果其他应用也使用action bar),系统可以为action bar优雅适配不同的屏幕配置。 图1. 一个action bar 包含:[1]应用图标,[2]两个操作项,[3]更多操作 action bar提供了一些关键功能: l 提供一个标志指明用户在你的
Published on: -
Android线程小结
1.Runnable Runnable是一个接口,被Thread继承: public interface Runnable { public void run(); } 2.Thread 线程,继承了Runnable,并重写了run()函数.在调用start()时,会调用底层的VMThread.create真正创建线程,然后执行run()函
Published on: -
Intent 匹配规则
本文翻译自Android API Guide,并经过整理. Intent 匹配规则:做三项测试:action,data,category 1.action测试: 一个过滤器中可以定义零个或多个action,如果Intent不包含action,那么它通过此项测试.如果Intent包含的action,那么需要和过滤器中的action匹配(相同)才能通过测试.如果过滤器不定义ac
Published on: -
android下播放器视频输出方法总结
在Android下输出视频画面,有很多种方法,每个都有自己的特点,比如将视频数据送回到java层然后用lockCanvas画出来这种方法的特点就是慢. 上面算是第0种方法,这个完全不值得提倡. 使用OMXCodec解码器解出来的视频,可以让它自己输出,只要在打开解码器的时候给它传个ANativeWindow: sp OMXCodec::Create( cons
Published on: