Android中Bitmap和Drawable
摘要:一、相关概念1、Drawable就是一个可画的对象,其可能是一张位图(BitmapDrawable),也可能是一个图形(ShapeDrawable),还有可能是一个图层(LayerDrawable),我们根据画图的需求,创建相应的可画对象2、Canvas画布,绘图的目的区域,用于绘图3、Bitmap位图,用于图的处理4、Matrix矩阵二、Bitmap1、从资源中获取Bitmap1 Resources res = getResources();2 Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable....
阅读全文
Android消除Toast延迟显示
摘要:Toast可以用来显示音量改变或者保存更新消息,如果用户一直点击,Toast会排队一个一个的,直到消息队列全部显示完,这样的效果显然是不好的,下面来看解决方法 Toast.makeText(activity, text, duration)每次会实例化一个Toast,所以 1 if (toast != null) 2 { 3 toast.setText(text); 4 toast.setDuration(duration); 5 toast.show(); 6 } else 7 { 8 toast = T...
阅读全文
gen already exists but is not a source folder. Convert to a source folder or rename it 的解决办法
摘要:1. Right click on the project and go to "Properties" //鼠标右键点击项目,然后选中Properties 2. Select "Java Build Path" on the left //选择java Build Path 3. Open "Source" tab // 打开源文件的tab栏 4. Click "Add Folder..." //点击添加文件夹 5. Check "gen" folder and click Ok and Ok
阅读全文