开发者

How do I scale graphics properly for an Android phone app moving to 3.x

开发者 https://www.devze.com 2023-04-12 08:04 出处:网络
Situation I have an app that I have been developing with Froyo as the target and I have followed all the bes开发者_开发问答t practise guidelines (dp for sizes, sp for text, 9-patch drawables, no abso

Situation

I have an app that I have been developing with Froyo as the target and I have followed all the bes开发者_开发问答t practise guidelines (dp for sizes, sp for text, 9-patch drawables, no absolute layouts e.t.c.). My layout xmls are in the default layout directory and the bulk of my images are in drawable-hdpi. It runs brilliantly on real-life phone hardware at both mdpi (tested on 480x320) and hdpi (tested on 800x480) with the gui staying perfectly proportioned and text staying sharp.

I've recently decided to migrate to tablets, my intention is to have the app run on tablets with the same screen proportions with crisp graphics (but at the very least for 9-patch drawables and text).

Problem

I tried to deploy the app on an Asus Transformer Tablet running Honeycomb 3.2 (it has has a 10.1 screen at 1280x800 which I think is xlarge, mdpi). As is I get either:

  1. Zoom to fill Screen: the gui blown up to the correct ratios/proportions but everything is blury (images as well as text) I suspect it is effectively the 480x320 version being expanded.Images loaded from sd card are also being displayed at low-res.

  2. Stretch to fill Screen: images and text are all crisp however they are out of place and in almost all cases too small. I've measured and pixel for pixel mesurements of images are the same as on a 480x320 screen.

I have also tried to set the project target to Honeycomb 3.2 (version 13) and set the options for the supported screens as suggested in all the other replies I could find on the site and all I got was the result from (1) above but and no resize option icon in the task bar.

Can anyone help, thanks in advnce?


Have you included the <supports-screens> tag in your Manifest?

<supports-screens 
   android:xlargeScreens="true" 
   android:largeScreens="true" 
   android:normalScreens="true"
   android:smallScreens="true" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号