2

壁紙の設定について少し混乱しています。私の銀河では、コードで壁紙を設定するとデフォルトでスクロールしませんが、galary が壁紙を設定するとスクロールします

5 画面にまたがる壁紙を避ける

ホームランチャーアプリに依存しますが、コードでスクロールを有効にして無効にするにはどうすればよいですか

// the content of our screen.
    setContentView(R.layout.wallpaper_2);
    final WallpaperManager wallpaperManager = WallpaperManager
            .getInstance(this);
    final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
    final ImageView imageView = (ImageView) findViewById(R.id.imageview);
    imageView.setDrawingCacheEnabled(true);
    imageView.setImageDrawable(wallpaperDrawable);

    Button randomize = (Button) findViewById(R.id.randomize);
    randomize.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            int mColor = (int) Math.floor(Math.random() * mColors.length);
            wallpaperDrawable.setColorFilter(mColors[mColor],
                    PorterDuff.Mode.MULTIPLY);
            imageView.setImageDrawable(wallpaperDrawable);
            imageView.invalidate();
        }
    });

    Button setWallpaper = (Button) findViewById(R.id.setwallpaper);
    setWallpaper.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            try {
                wallpaperManager.setBitmap(imageView.getDrawingCache());
                finish();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

wallpaperwizardriiアプリケーションは、スクロール機能ではなくスクロール機能をサポートしています。これは、その場所で可能であることを意味しますが、多くの時間を費やした後、解決策を得ることができませんでした。

設定しようとしましwallpaperManager.setWallpaperOffsetSteps(xStep, yStep);たが、結果を取得できません。認識していない API がありませんか?

助けてください よろしくお願いします...

編集:以下のコードから携帯電話に1つの壁紙を設定していますが、携帯電話にはICSがありますが、エミュレーターでは伸びているため、結果は問題ありません。

WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
            R.drawable.dashboard);
    Bitmap useThisBitmap = Bitmap.createScaledBitmap(bitmap,
            wallpaperManager.getDesiredMinimumWidth(),
            wallpaperManager.getDesiredMinimumHeight(), true);
    bitmap.recycle();

    try {
        wallpaperManager.setBitmap(useThisBitmap);
    } catch (IOException e) {
        e.printStackTrace();
    }

    Log.e("", "Width : " + wallpaperManager.getDesiredMinimumWidth());
    Log.e("", "Height : " + wallpaperManager.getDesiredMinimumHeight());

オフセットとの関係はありますか??

4

0 に答える 0