屏幕适配
常规适配手段
使用像素密度无关的尺寸单位
- 避免写死控件,尽量多使用
wrap_content
、match_parent
、weight
- 控件距离使用
dp
字体大小使用sp
- 不要用写死的
px
值
布局方面
- 使用相对布局,禁用绝对布局
- 使用约束布局
ConstraintLayout
- 使用百分比布局
使用布局限定符
- 使用尺寸限定符
res/layout-large
- 使用最小宽度限定符
res/layout-sw600dp
- 使用可用宽度限定符
res/layout-w600dp
- 使用布局别名
res/layout/main.xml
res/layout/main_twopanes.xml
- 使用屏幕方向限定符
res/layout-land
res/layout-sw600dp-land/