屏幕适配
1.dp
2. 百分比
- 代码去动态计算
- 利用weight(weight必须依赖Linearlayout,而且并不能适用于任何场景)
- 多用match_parent
- 多用weight
- 自定义view解决
例如 :<Button
android:text="@string/hello_world"
android:layout_width="20%w"
android:layout_height="10%h"/>
本文介绍了多种屏幕适配的方法,包括使用dp单位、百分比布局、动态计算尺寸等技术手段,并探讨了LinearLayout中weight属性的应用场景及其限制。此外,还提到了自定义View作为解决复杂适配问题的一种方案。
例如 :<Button
android:text="@string/hello_world"
android:layout_width="20%w"
android:layout_height="10%h"/>
1087
3605

被折叠的 条评论
为什么被折叠?