分类目录归档:ANDROID
ios 自定义rgb颜色
//***宏定义 #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >>16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0alpha:1.0] 例如: self.view.backgroundColor = UIColorFromRGB(0xF4F4F4);//***0xF4F4F4是RGB值
mac 下ndk安装
1、从官网下载 http://developer.android.com/tools/sdk/ndk/index.html 2、解压到一个文件夹 我是解压到:/Users/username/Documents/Android 下面; 3、配置NDK 设置环境变量,在 ~ 下编辑 vim .bash_profile export PATH=$PATH:/Users/yanjun/Documents/Android/android-ndk-r8c 保存后,退出; 4、按官网的文档,本来到现在就可以使用了,但是要对 /Users/yanjun/Documents/Android/android-ndk-r8c 进行一个属性修改: xattr -r -d com.apple.quarantine android-ndk-r8c 否则,使用 ndk-build会提示: -bash: /Users/username/Documents/Android/android-ndk-r8c/ndk-build: /bin/sh: bad interpreter: Operation not permitted
mac下adb不能连接adnroid设备
1、关于本机–>更多信息->概系统览->系统报告->usb->你所连接的device–>供应商ID 2、echo 0x04e8(供应商ID) >> ~/.android/adb_usb.ini 3、adb kill-server 4、adb devices
ios 动画 总结
1. CATransition *animation2 = [CATransition animation]; [animation2 setDuration:1.25f]; [animation2 setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; [animation2 setType:kCATransitionReveal]; [animation2 setSubtype: kCATransitionFromBottom]; 2. CATransition *animation = [CATransition animation]; [animation setDuration:1]; animation.type = @”oglFlip”; [animation setSubtype:kCATransitionFromLeft]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; [self.navigationController pushViewController:controller animated:NO]; [self.navigationController.view.layer addAnimation:animation forKey:nil];
ubuntu 下 linphone-android 2.0.3 编译
1. 官网下载源码 http://www.linphone.org/eng/download/git.html 或直接git clone git clone git://git.linphone.org/linphone-android.git –recursive 2.配置相关编译环境 下载后首先看里面的readme. 1) 下载 Android ndk (>=r5c) . 2) 安装: autoconf, automake, aclocal, libtoolize,pkgconfig sudo apt-get install autools-dev (自动安装autoconf,automake,aclocal) sudo apt-get install libtool 3.编译 1) 进去根目录 ./prepare_sources.sh 2) ndk-build 编译就成功后,libs目录下就有已经编译好的各种 so了 … 继续阅读
android 生成 keystore 并重新打包反编译后的程序
1.反编译某app : ./apktool d xx.apk 2.完成需要的修改,如添加中文翻译: 3.制作keystore mkdir keystore keytool -genkey -alias leikang.keystore -keyalg RSA -validity 40000 -keystore leikang.keystore 4.重新打包资源文件为apk ./apktool b xx.apk 5.将3生成的keystore复制到dist(与重新打包的apk相同目录)目录下 6.jarsigner -verbose -keystore leikang.keystore -signedjar xxx_signed.apk xxx.apk leikang.keystore 7.zipalign -v 4 xxx.apk final_xxx.apk
访问其它app SharedPreferences
I:访问本程序的(FirstApp)SharedPreferences中的数据代码如下: Java代码 SharedPreferences sharedPreferences = getSharedPreferences(“first_app_perferences”, Context.MODE_PRIVATE); String name = sharedPreferences.getString(“name”, “”); //getString()第二个参数为缺省值,如果preference中不存在该key,将返回缺省值 int age = sharedPreferences.getInt(“age”, 1); II:访问其他应用中的Preference(在SecondApp中访问FirstApp的数据),前提条件是:FirstApp的preference创建时指定了Context.MODE_WORLD_READABLE或者Context.MODE_WORLD_WRITEABLE权限。 如:在 为com.first.app的应用使用下面语句创建了preference(“first_app_perferences”)。 Java代码 getSharedPreferences(“first_app_perferences”, Context.MODE_WORLD_READABLE); 在SecondApp中要访问FirstApp应用中的preference,首先需要创建FirstApp应用的Context, 然后通过Context 访问preference ,访问preference时会在应用所在包下的shared_prefs目录找到preference : Java代码 Context firstAppContext = createPackageContext(“com.first.app”, Context.CONTEXT_IGNORE_SECURITY); SharedPreferences sharedPreferences = firstAppContext.getSharedPreferences (“first_app_perferences”, … 继续阅读
android 绘图 抗锯齿
两种方式: 1、paint.setAntiAlias(true); 2、canvas.setDrawFilter(new PaintFlagsDrawFilter (0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG));
android window 创建过程
一、应用窗口的创建 1、ams决定启动某个activity,通知客户端,有ActivityThread启动Activity,即构造一个Activity对象 2、ActivityThread调用Activity对象的attach()方法 3、attach()方法内部除了要进行重要变量初始化外,还会为Activity创建Window对象(通过调用PolicyManager的静态方法makenewwindow()完成,创建好的Window对象后,将其赋值给Activity的内部变量mWindow,并设置该WIndow的Callback接口为当前Activity对象 4、创建好Window对象后,需要给Window对象中的mWindowManager 变量赋值,该变量的类型是WindowManager类 5、配置好Activity和Window后,为窗口中添加真正的显示元素View或GroupView。这是从performLauncherActivity()内部调用callActivityOnCreate()开始的并且调用Activity的oncreater()类 6、调用Window的setContenView()方法: 首先调用installDecor()函数为Window类安装一个窗口修饰(标题栏),程序中制定的layout.xml界面将被包含在窗口修饰中,成为窗口内容,修饰窗口也是一个ViewGroup,窗口修饰及其内部的窗口内容加起来就是我们所说的窗口,即Window界面 安装完窗口修饰后,即可把用户界面layout.xml文件添加到窗口修饰中,在setcontentview()中调用inflate()完成 7、给Window类设置完试图元素后,把创建的这个窗口告诉Wms,以便Wms能够把该窗口显示在屏幕上。 makeVisible() 8、在makeVisible函数中,首先获得该Activity内部的WindowManager对象,即Window.LocalWindowManager对象,然后调用addView 9、调用WindowMangerImpl的addView函数(注意与8的addView的区别) A: 检查添加的窗口是否已经添加过,不允许重复添加 B:如果添加的是子窗口类型,找到其父窗口,并保存在内部变量panelParentView中 C:创建一个新的viewroot(每个窗口都对应一个viewroot对象) D:调用viewroot的setview()函数,完成最后的添加工作 10、将viewroot对象添加到mRoots对象中 11、调用viewroot对象的setview方法
