Problem with Bitmap scalling in Landscape mode

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Problem with Bitmap scalling in Landscape mode

Postby andreleitao » Thu Mar 26, 2009 8:53 pm

Hi there,

I'm trying to scale a Bitmap object for Landscape mode on emulator. The code to create and scale the bitmap is placed below:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mBackgroundImage = BitmapFactory.decodeResource(res, R.drawable.background);
  2.  
  3. mBackgroundImage = mBackgroundImage.createScaledBitmap(
  4.  
  5.                                 mBackgroundImage,
  6.  
  7.                                 display.getWidth(),
  8.  
  9.                                 display.getHeight(),
  10.  
  11.                                 true);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Look at the parameter display.getHeight(). It should return the actual screen height, right? But it does not. The display.getWidth() parameter works fine. The bitmap's width is perfect, but its height is out of the screen. I don't understand. Is a display.getHeight() bug? If I change display.getHeight() for 220 the bitmaps height becomes correct. :? E.g.:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mBackgroundImage = BitmapFactory.decodeResource(res, R.drawable.background);
  2.  
  3. mBackgroundImage = mBackgroundImage.createScaledBitmap(
  4.  
  5.                                 mBackgroundImage,
  6.  
  7.                                 display.getWidth(),
  8.  
  9.                                 220,
  10.  
  11.                                 true);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4



Have someone been seen this problem before?

Thanks!
andreleitao
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Mar 10, 2009 9:56 pm
Location: Recife - Brazil

Top

Postby andreleitao » Thu Mar 26, 2009 9:41 pm

:oops: :oops: :oops:

Now I can see that my application is not in FULLSCREEN mode. There is a reserved space for device clock bar and the application title. :P

Then... the problem is solved!

:)
andreleitao
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Mar 10, 2009 9:56 pm
Location: Recife - Brazil

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests