Android liveWallpaper background

[亡魂溺海] 提交于 2019-12-12 18:22:25

问题


How do I scroll the background image on an ACTION_MOVE event?

Here is my code used to draw the background image:

void drawFrame() {
    final SurfaceHolder holder = getSurfaceHolder();

    Canvas c = null;
    try {
        c = holder.lockCanvas();
        if (c != null) {
            c.drawBitmap(myBg, 0, 0, mPaint);
        }
    } finally {
        if (c != null) holder.unlockCanvasAndPost(c);
    }

    // Reschedule the next redraw
    mHandler.removeCallbacks(mDrawAnim);
    if (mVisible && mAnime) {
        mHandler.postDelayed(mDrawAnim, 50 );
    }
}

来源:https://stackoverflow.com/questions/8269991/android-livewallpaper-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!