我正在制作一个自定义列表视图项。扩展 View 并覆盖 onDraw 方法。
private Bitmap bmpScaledBackground; //with size:(screenWidth , screenHeight/4)
@Override
public void onDraw(Canvas canvas){
canvas.drawBitmap(bmpScaledBackground , 0 , 0 , null);
//...more of that
}
到目前为止,它在 Galaxy SII 等普通手机上运行良好。
然而,当谈到 Galaxy Nexus 时,性能很差。我相信这是因为GN(1280x720)的大分辨率。
在上述情况下,仅背景位图(bmpScaledBackground)就高达 720x320,需要很长时间才能绘制。更不用说OOM的风险了。
我写信询问是否有更可扩展的方式(SurfaceView 和 OpenGL 除外)来制作自定义视图。
对不起我糟糕的英语。