1.使用touchlistener时,如果需要判断MotionEvent.ACTION_DOWN或者MotionEvent.ACTION_UP时,需要对目标控件设置
setLongClickable(true);才有效。
2.Margin:用来设置一个元素所占空间的边缘到相邻元素之间的距离.
Padding:用来设置元素内容到元素边界的距离。
3.Note: When installing JDK on Windows, the default is to install in the "Program Files" directory. This location will cause ant to fail, because of the space. To fix the problem, you can specify the JAVA_HOME variable like this: set JAVA_HOME=c:"Prora~1"Java". The easiest solution, however, is to install JDK in a non-space directory, for example: c:"java"jdk1.6.0_02.
4.APK签名的另一种方法:
When you publish an app on the market, you need to sign it with a personal private key. The typical way to generate the key is with keytool, and then sign it with jarsigner. But this is generally a pain ;)
The git source tree has a SignApk.jar utility that is easier to use to sign apks. You can use the following three steps to generate a key and certificate that can be used with SignApk.jar
openssl genrsa -out key.pem 1024
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
Then, you can sign an apk using the SignApk.jar tool and the key.pk8 and certificate.pem files you created
java -jar SignApk.jar certificate.pem key.pk8 Application.apk Application_signed.apk
Retrieved from "http://android-dls.com/wiki/index.php?title=Generating_Keys"
5.E/AndroidRuntime(10851): java.lang.SecurityException: Permission
> Denial: starting Intent { act=android.intent.action.SEARCH
> cmp=com.amazon.mp3/.client.activity.SearchActivity (has extras) } from
> ProcessRecord{43cd17f0 10851:com.myTestApp/10054} (pid=10851,
> uid=10054) requires null
"requires null" means that there is no permission, but that particular
component is not exported from the .apk, so -nobody- else can use it.
原因在于要调用的activity在另外一个app里,不允许显示的调用。
解决:
使用隐士intent或签名
6.查看android 自带app的签名
在android.mk下有一行如LOCAL_CERTIFICATE := platform,那么签的就是platform的名。
签名文件位置:android1.6r1/build/target/product/security