引入依赖
implementation ‘com.zhy:autolayout:1.4.5’
在你的项目的AndroidManifest中注明你的设计稿的尺寸。
让你的类继承自AutoLayoutActivity
如果不继承AutoLayoutActivity可以在编写布局文件时,将
LinearLayout -> AutoLinearLayout
RelativeLayout -> AutoRelativeLayout
FrameLayout -> AutoFrameLayout
支持的属性
layout_width
layout_height
layout_margin(left,top,right,bottom)
pading(left,top,right,bottom)
textSize
maxWidth, minWidth, maxHeight, minHeight