
Android
文章平均质量分 55
xulaoban
等待阳光静静看着它的脸,重重的壳挂着轻轻的仰望,让风吹干流过的泪和汗,总有一天我要拥有我的天。
展开
-
onSaveInstanceState和onRestoreInstanceState的使用方法
先看Application Fundamentals上的一段话: Android calls onSaveInstanceState() before the activity becomes vulnerable to being destroyed by the system, but does not bother calling it when the instance转载 2012-06-27 17:20:01 · 554 阅读 · 0 评论 -
ShareUserId不一致导致数据丢失问题
开发一个应用的过程中发现一个问题,就是发布应用的初版是没有添加ShareUserId,后面版本升级的时候团队中的同学添加ShareUserId,导致新版本升级以后版本不兼容,初版软件应用保存的data全部被删除了,这问题坑人呀。所以设计的时候,要么想好添加ShareUserId,要么不加ShareUserId,这样方便扩展,不要为此埋雷。原创 2015-07-09 18:05:31 · 546 阅读 · 0 评论 -
Paint方法setXfermode
android.graphics.Paint方法setXfermode (Xfermode x...http://my.oschina.net/smalant/blog/40328 用法:设置两张图片相交时的模式例子:1mPaint = new Paint();2 m转载 2015-02-27 16:02:28 · 471 阅读 · 0 评论 -
Android Paint和Color类
要绘图,首先得调整画笔,待画笔调整好之后,再将图像绘制到画布上,这样才可以显示在手机屏幕上。Android 中的画笔是 Paint类,Paint 中包含了很多方法对其属性进行设置,主要方法如下: setAntiAlias: 设置画笔的锯齿效果。 setColor: 设置画笔颜色 setARGB: 设置画笔的a,r,p,g值。 setAlpha: 设置转载 2015-02-27 17:46:03 · 983 阅读 · 0 评论 -
The content of the adapter has changed but ListView did not receive a notification 异常解析
在Android编程中使用Adapter时,偶尔会出现如下错误:The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread,转载 2013-04-08 16:20:17 · 1844 阅读 · 0 评论 -
Eclipse中出现Select at least one project解决办法
今天遇到个问这个问题的,顺便帮解决了,是在导入工程的时候出现的,这是因为有同名的工程的,进入windows->show view->project explorer 这里找出来删掉再导入工程即可。转载 2013-03-22 14:03:23 · 35667 阅读 · 13 评论 -
Looper的方法详解
Looper用于封装了android线程中的消息循环,默认情况下一个线程是不存在消息循环(message loop)的,需要调用Looper.prepare()来给线程创建一个消息循环,调用Looper.loop()来使消息循环起作用,从消息队列里取消息,处理消息。注:写在Looper.loop()之后的代码不会被立即执行,当调用后mHandler.getLooper().quit()转载 2013-01-03 11:14:42 · 1689 阅读 · 0 评论 -
LinearLayout上onFling事件失效问题
1. 写一个类,实现OnGestureListener, OnTouchListener接口。重写里面的方法,记得把onDown()方法return true;这样才能触发onFling事件。 2. 设置layout的onTouch事件: LinearLayout layout = (LinearLayout) findViewById(R.id.mylayout); layout转载 2012-12-17 20:39:15 · 697 阅读 · 0 评论 -
使用ListView应该注意的地方
在ListView中设置Selector为null会报空指针? mListView.setSelector(null);//空指针 试试下面这种: mListView.setSelector(new ColorDrawable(Color.TRANSPARENT)); 如何让ListView初始化的时候就选中一项? ListView需要在初始化好数据后,其中一项需要呈选中状转载 2012-10-11 11:36:47 · 563 阅读 · 0 评论 -
Prototype设计模式的原理和用法
在软件开发中,有时候可能会需要创建一些特别复杂的对象,如果系统中已经存在同样类型的对象,并且不同的属性个数相差不大的话,用Prototype模式可能是一个理想的选择。定义 :用原型实例指定创建物件的种类,并且通过拷贝这些原型创建新的物件。Prototype 模式允许一个物件再创建另外一个可定制的物件,根本无需知道任何如何创建的细节,工作原理是:通过将一个原型物件传给那个要发动创建的转载 2012-07-13 15:43:17 · 596 阅读 · 0 评论 -
Android中ShareUserId注意问题
1、两个App的ShareUserId相同,则共享对方的data目录下的文件,包括SharePreference, file, lib等文件。 2、转载 2015-07-09 17:35:18 · 1540 阅读 · 0 评论