[android-developers] Fullscreen surface view

2011-06-22 Thread Martin Wallgren
Hi,

I'm trying to create a SurfaceView that covers the screen and that
does not have any scaling.

In My AndroidManifest I have

supports-screens
android:smallScreens=true
android:normalScreens=true
android:largeScreens=true
android:anyDensity=false /

and in the constructor of my surfaceView I do
  getHolder().setFixedSize(screenWidth, screenHeight); // 480, 800 in
my current emulator

The call I get to surfaceChanged is indeed the correct dimensions
  06-22 06:37:28.889: DEBUG/AnimatorThread(690): surfaceChanged
width=480 heigth=800

But when I lock the canvas I get a canvas that is only 320, 533
  06-22 06:37:28.969: DEBUG/AnimatorThread(690): Canvas[w=320, h=533]

I believe this has to do with dpi scaling. When I draw a bitmap that
is 480x800 to that canvas it will only get painted within the bounds
of the canvas (of course), and the pixels outside the canvas does not
get painter.

What can I do to get a fullscreen SurfaceView that has the same size
on the canvas as the pixel dimensions of the screen?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Fullscreen surface view

2011-06-22 Thread Dianne Hackborn
Why are you setting anyDensity to false?  Don't do that.

And really, it's 2011.  Just set android:targetSdkVersion to = 4 and let
the default modern values for these be used. :)

On Tue, Jun 21, 2011 at 11:46 PM, Martin Wallgren martin.wallgren.it@
gmail.com wrote:

 Hi,

 I'm trying to create a SurfaceView that covers the screen and that
 does not have any scaling.

 In My AndroidManifest I have

supports-screens
android:smallScreens=true
android:normalScreens=true
android:largeScreens=true
android:anyDensity=false /

 and in the constructor of my surfaceView I do
  getHolder().setFixedSize(screenWidth, screenHeight); // 480, 800 in
 my current emulator

 The call I get to surfaceChanged is indeed the correct dimensions
  06-22 06:37:28.889: DEBUG/AnimatorThread(690): surfaceChanged
 width=480 heigth=800

 But when I lock the canvas I get a canvas that is only 320, 533
  06-22 06:37:28.969: DEBUG/AnimatorThread(690): Canvas[w=320, h=533]

 I believe this has to do with dpi scaling. When I draw a bitmap that
 is 480x800 to that canvas it will only get painted within the bounds
 of the canvas (of course), and the pixels outside the canvas does not
 get painter.

 What can I do to get a fullscreen SurfaceView that has the same size
 on the canvas as the pixel dimensions of the screen?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en