DreamSea

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

有时候我们为了做一个Android平板应用,需要设置一个和平板大小一致的模拟器。但是SDK给出模拟器中只有三星GALAXY TAB,其并不符合我们的要求

所以,我们需要定制我们自己所需要的模拟器。

(1)平板大小最小也是7寸,属于大尺寸屏幕。

所以我们选择屏幕的skin时也要用大屏幕的...在Android 3.0中提供了 WXGA ,

当然你可以使用2.2中的WXGA800也可以。不过需要再设置Resolution为你指定的分辨率x*y

(2)设置屏幕的density  (Abstracted LCD Density)

      记住这个公式:

      DENSITY = sqrt (x^2+y^2)/d

     x,y分别为横向和纵向的像素大小. d为屏幕的尺寸

 

320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).

http://developer.android.com/guide/practices/screens_support.html

Modify

Abstracted LCD Density

So, if you have same number of pixels with more screen density, it's got to be a smaller screen.

The formula is:

DENSITY = sqrt (x^2+y^2)/d where d is the diagonal in inches.

So, supposing you want a d=7", then you need a density of:

Density=sqrt(1280x1280+800*800)/7 = 215'6339

So, fix the ABSTRACTED LCD DENSITY to 216 and there you are.

(3) 注意avd时要 注意scale display to real size 可以调整模拟器在自己屏幕上的大小 ,如果是10寸平板就选10吧。

     运行后,模拟器是没有键盘的。 但可以用我们的物理键盘来操作。下面是键盘和模拟器按键映射

Keyboard Commands (android emulator keys mapping keys of your keyboard)
http://developer.android.com/tools/help/emulator.html
Emulated Device Key Keyboard Key
Home HOME
Menu (left softkey) Page-up or F2
Star (right softkey) Page Down or Shift-F2
Back ESC

Call/dial button F3
Hangup/end call button F4
Search F5
Power button F7

Audio volume up button KEYPAD_PLUS, Ctrl-F5
Audio volume down button KEYPAD_MINUS, Ctrl-F6
Camera button Ctrl-KEYPAD_5, Ctrl-F3

Switch to previous layout orientation (for example, portrait, landscape) KEYPAD_7, Ctrl-F11
Switch to next layout orientation (for example, portrait, landscape) KEYPAD_9, Ctrl-F12

Toggle cell networking on/off F8
Toggle code profiling F9 (only with -trace startup option)
Toggle fullscreen mode Alt-Enter
Toggle trackball mode F6

Enter trackball mode temporarily (while key is pressed) Delete
DPad left/up/right/down KEYPAD_4/8/6/2
DPad center click KEYPAD_5
Onion alpha increase/decrease KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)

posted on 2012-07-27 11:33  DreamSea  阅读(2974)  评论(0编辑  收藏  举报