Android提供了Android-percent-support这个库,支持百分比布局,在一定程度上可以解决屏幕适配的问题。
他提供了两种布局:PercentRelativeLayout和PercentFrameLayout。
支持的属性:
layout_widthPercent
layout_heightPercent
layout_marginPercent
layout_marginLeftPercent
layout_marginTopPercent
layout_marginRightPercent
layout_marginBottomPercent
layout_marginStartPercent
layout_marginEndPercent
基本使用
build.gradle添加:
compile 'com.android.support:percent:25.2.0'