随笔分类 -  Android

摘要:1.Image and android style file(xml file) android\frameworks\base\core\res\res\drawable ..... 阅读全文
posted @ 2012-09-27 11:37 Qiengo 阅读(151) 评论(0) 推荐(0)
摘要:code: OnTouchListener touchListener=new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { System.out.println("mContent/2 touch:"+event); mGestureDetector.onTouchEvent(event); mPageIndicator... 阅读全文
posted @ 2012-09-24 18:13 Qiengo 阅读(1528) 评论(0) 推荐(0)
摘要:codeprotected NinePatchDrawable shadowLeft;......Bitmap image = BitmapFactory.decodeResource(context.getResources(),R.drawable.shadow_left);byte[] chunk= image.getNinePatchChunk();shadowLeft=new NinePatchDrawable(context.getResources(), image, chunk, new Rect(), null);shadowLeft.setBo... 阅读全文
posted @ 2012-09-19 13:23 Qiengo 阅读(730) 评论(0) 推荐(0)
摘要:由于OPENGL ES 取消了QUAD 等的支持,所以所有多边形都得需要从三角面片来组合成。这样就需要通过GL_TRIANGLE_FAN和GL_TRIANGLE_STRIP来组织顶点,通过画多个三角面片来组成一个需要得形状。不同元素决定了定点的不同组织方式:GL_POINTS:绘制的是点,也就是单个的点,这样显示的时候不会看到。GL_LINES:绘制的是线段,只在每两个点之间画。GL_LINE_LOOP:绘制出来的点将做到首尾相连,试想,如果不是用的这个而是直接用line的话,那么就要手动连接,即在最后一个点的是很放一个首节点连起来。GL_LINE_STRIP:连起来的是一整条的,与line不 阅读全文
posted @ 2012-09-15 12:08 Qiengo 阅读(1678) 评论(0) 推荐(0)
摘要:NOTEAs of this commit all "pages" will be 2-sided. There's a new class CurlPage, using which you can assign a separate texture on both sides, one for front side only, or same texture can be shared on both sides. CurlPage contains also color values for blending which allows you to e.g s 阅读全文
posted @ 2012-09-10 13:14 Qiengo 阅读(888) 评论(0) 推荐(0)
摘要:Shortcuts Command A.Shortcuts: Tab:(在文本终端下)可以使用TAB自动完成命令,或者显示所有的可选项。有时需要按两次显示。 Ctrl+C:终止当前进程(对于一般的小型文本模式的应用程序) Ctrl+Z:把当前进程送到后台处理。 Ctrl+A:切换到命令行开始 Ctr 阅读全文
posted @ 2012-09-03 11:50 Qiengo 阅读(353) 评论(0) 推荐(0)
摘要:http://www.igniterealtime.org/downloads/index.jsp在官网下载openfire服务器,Spark工具。下载asmack jar包。点击bin目录下的openfired.exe开启服务器。设定登录服务器:http://localhost:9090暂时只实现文字聊天XmppTool.javaimport org.jivesoftware.smack.ConnectionConfiguration;import org.jivesoftware.smack.XMPPConnection;import org.jivesoftware.smack.XMPP 阅读全文
posted @ 2012-08-24 17:44 Qiengo 阅读(773) 评论(0) 推荐(0)
摘要:libgdx绝对是一个相当不错的游戏引擎,最近一段时间的学习我感觉收获很多。但是我一直对于libgdx加载的图片大小必须是2的次方感到很纠结。如果是一张一般的图片想在libgdx中使用的话就需要自己去用ps什么的把图像拉一下,一两张没关系,但是数量大了还是有点烦。而且拉大的图片还需要TextureRegion来切割一下,实在麻烦。仔细看了一下libgdx的tool包,发现早有解决方案了。具体的类是imagepacker,在com.badlogic.gdx.tools.imagepacker包之中。它可以将多张图片合并在一张之中。同时可以通过原有文件的文件名获得图片资源。这里有几张图片:将它们放 阅读全文
posted @ 2012-08-07 09:30 Qiengo 阅读(682) 评论(0) 推荐(0)
摘要:正则表达式(regular expression)就是用一个“字符串”来描述一个特征,然后去验证另一个“字符串”是否符合这个特征。比如 表达式“ab+” 描述的特征是“一个 'a' 和 任意个 'b' ”,那么 'ab', 'abb', 'abbbbbbbbbb' 都符合这个特征。 正则表达式可以用来:(1)验证字符串是否符合指定特征,比如验证是否是合法的邮件地址。(2)用来查找字符串,从一个长的文本中查找符合指定特征的字符串,比查找固定字符串更加灵活方便。(3)用来替换,比普通的替换更强大。1. 正则表达式规则1 阅读全文
posted @ 2012-07-30 12:05 Qiengo 阅读(181) 评论(0) 推荐(0)
摘要:For detail:<ndk>/docs/android-mk.html一个Android.mk file用来向编译系统描述你的源代码。具体来说:该文件是GNU Makefile的一小部分,会被编译系统解析一次或多次。你可以在每一个Android.mk file中定义一个或多个模块,你也可以在几个模块中使用同一个源代码文件。编译系统为你处理许多细节问题。例如,你不需要在你的Android.mk中列出头文件和依赖文件。NDK编译系统将会为你自动处理这些问题。这也意味着,在升级NDK后,你应该得到新的toolchain/platform支持,而且不需要改变你的Android.mk文件 阅读全文
posted @ 2012-07-27 18:08 Qiengo 阅读(345) 评论(0) 推荐(0)
摘要:You may have ever come across this problom:While you are importing a project from somewhere,the hint says it contains error(s),but you can find any error sign.Then you cancheck up the build path:right click->properties->Java Build PathFix the errors first! 阅读全文
posted @ 2012-07-24 17:52 Qiengo 阅读(136) 评论(0) 推荐(0)
摘要:View the version of Proguard:1.open command window of windows.2.enter the folder of proguard,step intobindirectory.cd <your SDK path>\android-sdk\tools\proguard\bin3.runproguard A.Normal Condition Set theconfiguration file for progurad inproject.properties:# This file is automatically generate 阅读全文
posted @ 2012-07-24 15:20 Qiengo 阅读(1633) 评论(0) 推荐(0)
摘要:基础样例1)C部分1.1)TestJni.h/* * TestJni.h * * Created on: 2011-12-20 * Author: Join */ #ifndef TESTJNI_H_ #define TESTJNI_H_ #include <jni.h> #include <stdio.h> #include <stdlib.h> #include <android/log.h> #include <android/bitmap.h> // 测试回调Java #include "CallJava.h&quo 阅读全文
posted @ 2012-07-19 18:37 Qiengo 阅读(931) 评论(0) 推荐(0)
摘要:From the detail ofandroid Git repositories,seehttps://android.googlesource.com/git clone git://Android.git.kernel.org/device/common.gitgit clone git://Android.git.kernel.org/device/htc/common.gitgit clone git://Android.git.kernel.org/device/htc/dream-sapphire.git git clone git://Android.git.kernel.o 阅读全文
posted @ 2012-07-19 16:34 Qiengo 阅读(547) 评论(0) 推荐(0)
摘要:Format the time:SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String date = sDateFormat.format(new java.util.Date()); For Detail ,consulthttp://developer.android.com/reference/android/text/format/DateFormat.htmljava.text.DateFormatjava.text.format.DateFormatFo 阅读全文
posted @ 2012-07-17 16:46 Qiengo 阅读(1744) 评论(0) 推荐(0)
摘要:一.Android版本与Linux内核的关系 英文名 中文名 版本号 API level 发布时间 内核版本 以下是每个版本的详细分支,比如安卓4.4-kitkat,内部还有分支,分为4.4.1,4.4.2等等,下载的时候最好下载一个分支就好了,不然容量太大。 二.下载源码分为2大部分 1.Andr 阅读全文
posted @ 2012-07-16 11:04 Qiengo 阅读(3046) 评论(0) 推荐(0)
摘要:Android系统里面有3种类型的菜单:options menu,context menu,sub menu。options menu 按Menu键就会显示,用于当前的Activity。 它包括两种菜单项: 因为options menu在屏幕底部最多只能显示6个菜单项,这些菜单项称为icon menu,icon menu只支持文字(title) 以及icon,可以设置快捷键,不支持checkbox以及radio控件,所以不能设置checkable选项。 而多于6的菜单项会以“more” icon menu来调出,称为expanded menu。它不支持icon,其他的特性都和ico... 阅读全文
posted @ 2012-07-11 11:32 Qiengo 阅读(497) 评论(0) 推荐(0)
摘要:Matrix的数学原理平移变换旋转变换缩放变换错切变换对称变换代码验证Matrix的数学原理在Android中,如果你用Matrix进行过图像处理,那么一定知道Matrix这个类。Android中的Matrix是一个3 x 3的矩阵,其内容如下:Matrix的对图像的处理可分为四类基本变换:Translate 平移变换Rotate 旋转变换Scale 缩放变换Skew 错切变换从字面上理解,矩阵中的MSCALE用于处理缩放变换,MSKEW用于处理错切变换,MTRANS用于处理平移变换,MPERSP用于处理透视变换。实际中当然不能完全按照字面上的说法去理解Matrix。同时,在Android的文 阅读全文
posted @ 2012-06-30 11:22 Qiengo 阅读(19977) 评论(8) 推荐(10)
摘要:Android NDK发布后,java+C的编程方式成为android上性能编程的首选。但在C中调试困难,因此能使用logcat成为必须的要求。关于在Native代码中使用logcat,网上有很多说法,大部分有所欠缺,有的根本是错的。要使用logcat,首先在代码中要引入 log的头文件。#include <android/log.h>然后你可以简单的通过__android_log_write(ANDROID_LOG_ERROR,"Tag","Message"); 方法向logcat输出。log 级别有很多 : ANDROID_LOG_UNK 阅读全文
posted @ 2012-06-26 11:28 Qiengo 阅读(218) 评论(0) 推荐(0)
摘要:public static Bitmap loadFromFile(String filename) { try { File f = new File(filename); if (!f.exists()) { return null; } Bitmap tmp = BitmapFactory.decodeFile(filename); return tmp; } catch (Exception e) { return null; } }import java.io.F... 阅读全文
posted @ 2012-06-19 11:42 Qiengo 阅读(1991) 评论(0) 推荐(0)