Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android:在浏览五个主屏幕视图时移动背景图像_Java_Android_Android Canvas_Live Wallpaper - Fatal编程技术网

Java Android:在浏览五个主屏幕视图时移动背景图像

Java Android:在浏览五个主屏幕视图时移动背景图像,java,android,android-canvas,live-wallpaper,Java,Android,Android Canvas,Live Wallpaper,我想在浏览5个主屏幕视图时移动背景图像。 就像我们从gallery中选择图像并设置为墙纸,然后随着主屏幕视图(偏移)的更改而滚动一样 绘图功能是 { private void draw(Canvas canvas) { Paint paint = new Paint(); DisplayMetrics metdisplayMatrics = new DisplayMetrics(); Display display = ((WindowMa

我想在浏览5个主屏幕视图时移动背景图像。 就像我们从gallery中选择图像并设置为墙纸,然后随着主屏幕视图(偏移)的更改而滚动一样

绘图功能是

{
    private void draw(Canvas canvas) {
        Paint paint = new Paint();
        DisplayMetrics metdisplayMatrics = new DisplayMetrics();
        Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
        display.getMetrics(metdisplayMatrics);

            canvas.save();
            canvas.drawColor(0xff000000);
            mRecscreenRectangleFrame = new Rect(0, 0,  (int) (metdisplayMatrics.widthPixels*2.0), metdisplayMatrics.heightPixels);
            photo1= BitmapFactory.decodeResource(getResources(), R.drawable.img1);
            canvas.drawBitmap(photo1, null,mRecscreenRectangleFrame, paint);
            photo1.recycle();
            System.gc();
}               

请参阅我编辑的问题,我想创建静态墙纸。在浏览五个主屏幕视图时使用移动背景图像,这是我在墙纸服务中。。。
{
    private void draw(Canvas canvas) {
        Paint paint = new Paint();
        DisplayMetrics metdisplayMatrics = new DisplayMetrics();
        Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
        display.getMetrics(metdisplayMatrics);

            canvas.save();
            canvas.drawColor(0xff000000);
            mRecscreenRectangleFrame = new Rect(0, 0,  (int) (metdisplayMatrics.widthPixels*2.0), metdisplayMatrics.heightPixels);
            photo1= BitmapFactory.decodeResource(getResources(), R.drawable.img1);
            canvas.drawBitmap(photo1, null,mRecscreenRectangleFrame, paint);
            photo1.recycle();
            System.gc();
}