ro.sf.lcd_density:
===================
Device_dream_sapphire.mk (device\htc\dream-sapphire): ro.sf.lcd_density=160
DisplayHardware.cpp (frameworks\base\libs\surfaceflinger\displayhardware): if (property_get("qemu.sf.lcd_density", property, NULL) <= 0) {
DisplayHardware.cpp (frameworks\base\libs\surfaceflinger\displayhardware): if (property_get("ro.sf.lcd_density", property, NULL) <= 0) {
DisplayHardware.cpp (frameworks\base\libs\surfaceflinger\displayhardware): LOGW("ro.sf.lcd_density not defined, using 160 dpi by default.");
DisplayMetrics.java (frameworks\base\core\java\android\util): return SystemProperties.getInt("qemu.sf.lcd_density",
DisplayMetrics.java (frameworks\base\core\java\android\util): SystemProperties.getInt("ro.sf.lcd_density", DENSITY_DEFAULT));
Hw-lcd.c (external\qemu\android): boot_property_add("qemu.sf.lcd_density", temp);
Passion.mk (device\htc\passion): ro.sf.lcd_density=240 \
simcom.prop
==============
#
# prop for EA77-TELECOM
#
# default is 160, should be 120 on WQVGA
ro.sf.lcd_density=120
# disable tether
ro.tether.denied=true
# Default network type: 4 => NETWORK_MODE_CDMA
ro.telephony.default_network=4
# used for filter apn settings
ro.cdma.home.operator.numeric=46003
# product info
ro.hardware.version=V1.00_PCB
ro.build.display.id=V0.4_20101126
ro.product.model=EA77
ro.product.brand=China Telecom
ro.product.manufacturer=SIMCOM
StatusBar下拉Notification宽度满屏解决方法:
Density获取的部分在DisplayMetrics.java这个类里面,如果SDK文档中所说的,系统定义了3个等级的density,分别是low-120,medium-160,high-240。
1 public class DisplayMetrics {
2 /* *
3 * Standard quantized DPI for low-density screens.
4 */
5 public static final int DENSITY_LOW = 120 ;
6
7 /* *
8 * Standard quantized DPI for medium-density screens.
9 */
10 public static final int DENSITY_MEDIUM = 160 ;
11
12 /* *
13 * Standard quantized DPI for high-density screens.
14 */
15 public static final int DENSITY_HIGH = 240 ;
16
17 /* *
18 * The reference density used throughout the system.
19 */
20 public static final int DENSITY_DEFAULT = DENSITY_MEDIUM;
21
22 . . . .
同时,代码中把160的Density设置为默认的Density,也就是当前,机器中的Density。那如何设置这个Density。同样在这个类最下面,找到系统获取Density的方法:
1 private static int getDeviceDensity() {
2 // qemu.sf.lcd_density can be used to override ro.sf.lcd_density
3 // when running in the emulator, allowing for dynamic configurations.
4 // The reason for this is that ro.sf.lcd_density is write-once and is
5 // set by the init process when it parses build.prop before anything else.
6 return SystemProperties . getInt( " qemu.sf.lcd_density " ,
7 SystemProperties . getInt( " ro.sf.lcd_density " , DENSITY_DEFAULT));
8 }
从这个方法中可以看到,系统会去读系统的属性。先去读ro.sf..lcd_density,若存在,那么设置这个属性记录的density的值。否则,则取默认值也就是160。看来我源码的属性中并没有设置这一density的值。这个值在源码中的system.prop中修改
由于我不想重新编译系统。所以,我直接在编译好的build.prop中加上
ro.sf.lcd_density=240
重启测试,发现果然,屏幕的分辨率发生了变化,且Notification也全屏了。
觉得240的图标都太大了,我重新设置到200。(试验过在我的800x600的屏上,低于200,都不能使之满屏)
此方法也使用于当你机器玩游戏不满屏的情况。把这个density设置低一点,那么就能满屏玩了。
对于手机用户,使用adb shell连接到手机,取得root权限后修改ro.sf.lcd_density的值就能达到效果
另一种方法:
当然,如果你想保证你的Density不变,那可以只修改CompatibilityInfo.java这个文件,把DEFAULT分辨率的值改成当前的屏幕分辨率,我的是800x600的,于是改成:
1 /* *
2 * The default width of the screen in portrait mode.
3 */
4 // public static final int DEFAULT_PORTRAIT_WIDTH = 320;
5 public static final int DEFAULT_PORTRAIT_WIDTH = 600 ;
6 /* *
7 * The default height of the screen in portrait mode.
8 */
9 // public static final int DEFAULT_PORTRAIT_HEIGHT = 480;
10 public static final int DEFAULT_PORTRAIT_HEIGHT = 800 ;
阅读(2683) | 评论(0) | 转发(0) |