1 概述
Android-percent-support这个库两种布局供大家使用: PercentRelativeLayout、PercentFrameLayout,通过名字就可以看出,这是继承自FrameLayout和RelativeLayout两个容器类;
支持的属性有(可以看到支持宽高,以及margin):
layout_widthPercent、layout_heightPercent、
layout_marginPercent、layout_marginLeftPercent、
layout_marginTopPercent、layout_marginRightPercent、
layout_marginBottomPercent、layout_marginStartPercent、layout_marginEndPercent。
接着,自定义一个PercentLinearLayout。
2 使用
首先记得在build.gradle添加
compile 'com.android.support:percent:22.2.0'
2.1 PercentRelativeLayout

2.2 PercentFrameLayout

2.3 复杂PercentRelativeLayout

博客介绍了Android - percent - support库,该库有PercentRelativeLayout和PercentFrameLayout两种布局,继承自FrameLayout和RelativeLayout,支持宽高、margin等属性,还可自定义PercentLinearLayout,同时说明了在build.gradle添加依赖的使用方法。
334

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



