今天看到个新的屏幕适配方案Android 屏幕适配方案,大致就是根据不同像素的屏幕等分成固定的分数(比如1080x1920的就是将所有屏幕的宽都分为1080份,所有屏幕高都分为1920份),而后根据屏幕去加载不同大小的像素
迫不及待上手,根据1080x1920为基准,写了个demo,两个色块应该是各占四分之一,
android:layout_width="@dimen/x540"
android:layout_height="@dimen/y960"
在两只手机上测试是正常的,
而在genymotion(1080x1920)上却遗憾的没有成功,
将代码直接改为像素,发现屏幕是正常的1080x1920,
android:layout_width="540px"
android:layout_height="960px"
天蓬老师2017-04-17 17:52:52
Genymotion can only do so much, it’s best to use cloud testing to see how the screen adapts
阿神2017-04-17 17:52:52
Android phones are notorious for their poor resolutions
To do screen adaptation, you can’t just rely on programmers, but also on product design
Don’t design the screen to be so crowded, the adaptation is Very well done