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

[问答]请问平时开发过程中,你是如何做到多分辨率适配的?平板和手机可以共用一套代码吗? #54

Open
zhdh2008 opened this issue Mar 12, 2015 · 4 comments

Comments

@zhdh2008
Copy link

No description provided.

@zhdh2008 zhdh2008 changed the title 请问平时开发过程中,你是如何做到多分辨率适配的?平板和手机可以共用一套代码吗? [问答]请问平时开发过程中,你是如何做到多分辨率适配的?平板和手机可以共用一套代码吗? Mar 12, 2015
@coolegos
Copy link

1.可以准备几套不同的图。
2.可以为不同分辨率的写不同的dimen文件。

@zimoguo
Copy link

zimoguo commented Mar 13, 2015

1.根据分辨率建立不同的布局文件
2.可以共用一套

@ly2251
Copy link

ly2251 commented Mar 13, 2015

这个我仅提供一个思路,并且证明是可行的
1.以1920*1080 1.5 的作为参考布局,所有布局均这么写,只写一个demin 和 layout(不同显示另算)
2.在程序启动时,获取当前屏幕的分辨率和密度,与上一条得出的结果做等比换算
3.将整个项目中使用的 View 全部重写 , 例如ScaleLinearyout 。将所有参数做等比算换
缺点:
比较奇怪的分辨率下会出现图片轻微拉伸情况

@soyoungboy
Copy link

其实还有就是多使用fragement

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

No branches or pull requests

5 participants