2016-9-6
1.android增量更新基本步驟
1. 獲取補丁 服務端完成
2. 打補丁 獲取應用的安裝路徑(getPackageManager().getApplicationInfo(packageName, 0).sourceDir),拷貝到sd卡,合併差分包到apk
3. 安裝生成的新的版本
2.在android上Canvas畫出平滑圖形
在Canvas繪製圖形有兩種方式:
1. 直接在Canvas繪製
這種方式只要設置Paint的ANTI_ALIAS_FLAG(抗鋸齒)屬性即可得到平滑圖形
如:Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
或: Paint p = new Paint();
p.setAntiAlias(true);
p.setDither(true);
然後在onDraw()中使用創建的paint繪製圖形即可
2. 先在Bitmap上繪製再將Bitmap繪製到Canvas上
此時要注意避免在 Bitmap 上重繪,或者在重繪前先清空 Bitmap, 並要使用上面創建的paint, 否則會出現繪製出的圖形有明顯的鋸齒
即要使用
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (bitmap == null) {
bitmap = Bitmap.createBitmap(200,
200,
Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(bitmap);
}
bitmapCanvas.drawColor(
Color.TRANSPARENT,
PorterDuff.Mode.CLEAR);
drawOnCanvas(bitmapCanvas);
canvas.drawBitmap(bitmap, mLeftX, mTopY, p);
}
protected void drawOnCanvas(Canvas canvas) {
canvas.drawCircle(mLeftX + 100, mTopY + 100, 100, p);
}
或者:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (bitmap == null) {
bitmap = Bitmap.createBitmap(200,
200,
Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(bitmap);
bitmapCanvas.drawColor(
Color.TRANSPARENT,
PorterDuff.Mode.CLEAR);
drawOnCanvas(bitmapCanvas);
}
canvas.drawBitmap(bitmap, mLeftX, mTopY, p);
}
protected void drawOnCanvas(Canvas canvas) {
canvas.drawCircle(mLeftX + 100, mTopY + 100, 100, p);
}
3.TextView默認上下有padding
設置此屬性includeFontPadding="false",可以去除
4.EditText設置光標在右側
同時設置:
android:gravity="right"
android:textCursorDrawable="@null"//"@null" 作用是讓光標顏色和text color一樣
android:cursorVisible="false"//設置光標不閃爍
5.Android獲取activity信息
adb shell activity -h 獲取幫助信息
adb shell activity package [package_name] 獲取該應用的與activity相關的信息
adb sehll activity activities 獲取所有正在運行的activity信息
adb shell dumpsys meminfo packagename -d 獲取應用的一些信息, 如view activity數量, 內存大小等