Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2020-01-15:你了解过哪些Android屏幕适配方面的技巧? #234

Open
Moosphan opened this issue Jan 15, 2020 · 2 comments
Open

Comments

@Moosphan
Copy link
Owner

No description provided.

@manondidi
Copy link

只保留xxhdpi的资源
使用字节跳动的适配方案,即篡改设备的像素密度参数 density,
可以使UI中写死dp的部分在不同的设备上随着屏幕宽度缩放,致使页面最终效果和UI设计图上和屏幕的比例一致

可以使用android新出的 约束布局 减少页面中需要用线性布局和相对布局嵌套实现的效果,但是线性布局和相对布局中直接能实现的,不需要用约束布局 因为约束布局更占用内存

另外可以根据横屏和竖屏的区别, 在屏幕上添加不同的fragment实现不同的布局

可以使用kotlin的 扩展功能 去扩展Float, 这样可以直接优雅的使用 xxx.dp() 实现px和dp的转换

@df13954
Copy link

df13954 commented Jan 15, 2020

头条方案~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants