Skip to content

可以设置默认不自适应吗 想适配的时候在继承 CustomAdapt #222

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

Closed
cl2980457390 opened this issue Sep 19, 2019 · 4 comments
Closed

Comments

@cl2980457390
Copy link

项目比较大 想默认不自适应,想适配时就继承CustomAdapt,通过多个版本迭代来实现适配,
不需要为每给Activity 设置CancelAdapt ,的设置有吗。

@JessYanCoding
Copy link
Owner

JessYanCoding commented Sep 19, 2019

不开启 dp 的适配,仅在需要适配的页面使用副单位,就可以分阶段逐步完成迁移,不会影响之前使用 dp 的旧页面。https://github.com/JessYanCoding/AndroidAutoSize/tree/master/demo-subunits

@JessYanCoding
Copy link
Owner

JessYanCoding commented Sep 19, 2019

https://github.com/JessYanCoding/AndroidAutoSize/blob/master/demo/src/main/java/me/jessyan/autosize/demo/BaseApplication.java#L119 如果只想使用 DP,不想使用副单位,也不想每个 Activity
实现 CancelAdapt,你可以使用 ExternalAdaptManager,将需要取消的 Activity 都传进去,虽然也需要一个个将类名传进去,但只需要在初始化时传,不需要去修改每个 Activity

density 的修改是全局的,一处修改,哪怕是系统控件和三方库也会受到影响,只可能默认开启,框架提供的取消操作,也是在需要取消适配的 Activity 绘制页面之前,将 density 还原为默认的,在需要适配的 Activity 绘制之前,再修改回来,如此不停的去切换,所以只能通过上述的方式实现取消操作,推荐第一种方式,更稳定,也不会影响三方库和系统控件

@fanturbo
Copy link

fanturbo commented Jan 5, 2020

@JessYanCoding @cl2980457390 修改默认的AutoAdaptStrategy应该就可以啊。

@JessYanCoding
Copy link
Owner

#233

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

3 participants