1

谁能告诉我如何在不缩放的情况下在 android 上准确设置墙纸.. 目前无论我使用什么分辨率的图像,它只是将其缩放并设置为墙纸..这是我正在使用的代码

setWallpaper.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                WallpaperManager wManager;
                try {                
                //  Bitmap bitmap = ((BitmapDrawable)imageView1.getDrawable()).getBitmap();
                    wManager = WallpaperManager.getInstance(getApplicationContext());
                    wManager.setBitmap(bitmaptwo);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
4

1 回答 1

1

固定它..只是用这个代替

setWallpaper.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                WallpaperManager wManager;

                try {

                //  Bitmap bitmap = ((BitmapDrawable)imageView1.getDrawable()).getBitmap();
                    wManager = WallpaperManager.getInstance(getApplicationContext());
                    fullWidth = wManager.getDesiredMinimumWidth();
                    fullHeight = wManager.getDesiredMinimumHeight(); 
                    Bitmap bitmapResized = Bitmap.createScaledBitmap(bitmaptwo, fullWidth, fullHeight,true);
                    wManager.setBitmap(bitmapResized);


                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        });
于 2012-11-17T13:35:17.870 回答