Comments (2)
@liupeng826 如果只适配某几个分辨率的设备,使用values-分辨率的方式,可以精准适配,但是可适应性差,如果没有指定分辨率的设备,布局会出现混乱,如果想要适应性更强,可使用sw适配方式,不管横屏还是竖屏,它是根据宽度来适配的,可适应性强,找不到设备的话会向下找距离sw最近的dimen文件,理论上可以适配所有设备。今日头条的适配方式也可以使用,具体可参考这个:https://note.youdao.com/share/?id=66cb07073329d19245b6e3aea9595269&type=note#/
from screenautopro.
横屏app适配有问题
如果app强制横屏,那么第一次安装的时候适配大小会有问题。
第一次安装 -- 杀掉程序 -- 再次打开,显示效果是不一样的
原因是heightPixels和widthPixels在横屏和竖屏是取到的值不一样:
//根据带入参数选择不同的适配方向
if (orientation.equals("height")) {
division = division(appDisplayMetrics.heightPixels, 516);
} else {
division = division(appDisplayMetrics.widthPixels, 960);
}
from screenautopro.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from screenautopro.