Android 百分比布局库(percent-support-lib)

Google开始支持百分比的方式布局了已经大半年了吧(7个月??)
https://github.com/JulienGenoud/android-percent-support-lib-sample 这个项目阐述了百分比布局方式,方法。

support-lib
这个库为我们提供了什么呢?
<li>两种布局:
<pre>PercentRelativeLayout,PercentFrameLayout,他们继承自FrameLayoutRelativeLayout两个容器类;</pre>
<li>支持的属性有:
<pre>
占宽比,占高比
layout_widthPercent
layout_heightPercent
左上右下,开始,结束,外边距比例
layout_marginLeftPercent
layout_marginTopPercent
layout_marginRightPercent
layout_marginBottomPercent
layout_marginStartPercent
layout_marginEndPercent

</pre>

也就是说,只要在开发过程中使用PercentRelativeLayout、PercentFrameLayout替换FrameLayout、RelativeLayout即可。

How to use : https://github.com/JulienGenoud/android-percent-support-lib-sample
使用条件:
Pre-requisites

Android SDK v22
Android Build Tools v22.0.1
Android Percent Support Repository v22.2.0
Android Support v4 Repository v22.2.0
according to the the manifest minsdk is v7 (android 2.1)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容