Android开发规范
Android开发规范
官方规范
地址: https://source.android.com/source/code-style
补充
-
ndk开发: native方法方法名以"native"开头,并遵循小驼峰命名法,且命名中不要包含'_'.
例如,以下示例来自
Bitmap.java
:private static native Bitmap nativeCreateFromParcel(Parcel p);
在
Canvas
同时存在两种方式,比较混乱:private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap, float srcLeft, float srcTop, float srcRight, float srcBottom, float dstLeft, float dstTop, float dstRight, float dstBottom, long nativePaintOrZero, int screenDensity, int bitmapDensity); private static native void native_drawBitmap(long nativeCanvas, int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha, long nativePaintOrZero);
-
native
方法全部使用private
修饰符,通过使用java方法调用.