随笔分类 -  Android技术

Android模拟按键——源码环境下开发应用程序
摘要:文章来源:http://hi.baidu.com/zhouhanqing/blog/item/1bfbaec593f4b5a48326acc7.html 在源码下写程序可以摆脱SDK的限制,毕竟SDK开放的API有限,比如我们实现模拟按键时,需要用到IWindowManager这个类,但是SDK中是不提供这个类的 首先下载编译源码,然后在源码的frameworks/base/cmds下新建一... 阅读全文

posted @ 2013-05-31 18:57 勤修 阅读(406) 评论(0) 推荐(0) 编辑

解析画布的clipRect方法
摘要:画布的clipRect方法,boolean android.graphics.Canvas.clipRect(int left, int top, int right, int bottom) 在看clipRect方法之前先看看如果将res目录下的图片文件转换为bitmap对象,这里总结了两种方法,大家可以参考使用, 第一种方法,采用BitmapDrawable, //得到Resources... 阅读全文

posted @ 2013-05-20 15:17 勤修 阅读(9662) 评论(0) 推荐(0) 编辑

使用android画布的save()和restore()方法
摘要:在调用画布的save()方法之后,可以对画布进行平移、旋转等操作, 然后再将需要画的内容draw到画布上去, 最后再调用restore()方法,恢复到调用save()方法之前的状态。 1 public class SubView extends TextView { 2 3 public SubView(Context context, AttributeSet attrs) {... 阅读全文

posted @ 2013-05-20 14:30 勤修 阅读(4167) 评论(0) 推荐(0) 编辑

android中使用DisplayMetrics获取屏幕参数
摘要:--关于Density int android.graphics.Bitmap.getDensity(),返回bitmap-density(密度)。默认的density就是当前display-density,除非当前应用程序不支持不同的screen-density。 在android.util.DisplayMetrics类中定义了一些变量和常量。 --常量DENSITY_XXX, int... 阅读全文

posted @ 2013-05-16 12:46 勤修 阅读(42501) 评论(0) 推荐(0) 编辑

android中给TextView设置属性ellipsize
摘要:1,ellipsize等于marquee,跑马灯效果 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" ... 阅读全文

posted @ 2013-05-15 18:33 勤修 阅读(22390) 评论(0) 推荐(1) 编辑

继承ViewGroup:重写onMeasure方法和onLayout方法
摘要:在继承ViewGroup类时,需要重写两个方法,分别是onMeasure和onLayout。 1,在方法onMeasure中调用setMeasuredDimension方法 void android.view.View.setMeasuredDimension(int measuredWidth, int measuredHeight) 在onMeasure(int, int)中,必须调用s... 阅读全文

posted @ 2013-05-13 13:49 勤修 阅读(13148) 评论(0) 推荐(1) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示