2014-12-07 2 views
0

나는 안드로이드에 벽지 응용 프로그램을 개발하고 있으며, 내 애플 리케이션을위한 스크롤 가능한 벽지를 설정하는 올바른 방법을 찾고 있습니다. 자, 내 코드는 비트 맵에서 배경 화면을 설정할 수 있지만 한 페이지에 맞게 잘리고 한 페이지에만 머물러 있습니다 (홈 화면에 5 페이지가 있음). 즉, 각 페이지의 콘텐츠가 배경 화면을 스크롤 할 수 있지만 배경 화면은 스크롤되지 않았습니다.스크롤 가능한 벽지 android

스크롤 가능한 배경 화면을 설정하고 싶습니다. 인터넷에서 일부 코드를 시도했지만 도움이되지 않았습니다. 혹시 들으신가요?

이 시도 내 코드

WallpaperManager wm = WallpaperManager.getInstance(mActivity.getContext()); 
    try { 
     wm.setBitmap(mCropImageView.getCroppedImage()); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 

답변

2

, 그것은 API> 11

//get screen height 
Display display = getWindowManager().getDefaultDisplay(); 
    Point size = new Point(); 
    display.getSize(size); 
    screenHeight = size.y; 

wallPaperBitmap= ... //your bitmap resource 

//adjust the aspect ratio of the Image 
//this is the main part 

int width = wallPaperBitmap.getWidth(); 
     width = (width * screenHeight)/wallPaperBitmap.getHeight(); 

//set the wallpaper 
//this may not be the most efficent way but it worked for me 

wallpaperManager.setBitmap(Bitmap.createScaledBitmap(wallPaperBitmap, width, height, true)); 
에 나를 위해 일한
관련 문제