Android Percent Layout 安卓百分比布局
来源:互联网 发布:个人业务介绍源码 编辑:程序博客网 时间:2024/05/29 04:34
谷歌官方支持按照百分比来设置布局的宽高。
支持PercentRelativeLayout和PercentFrameLayout,分别继承自RelativeLayout和FrameLayout
均支持以下属性:
layout_widthPercent
layout_heightPercent
layout_marginPercent
layout_marginLeftPercent
layout_marginTopPercent
layout_marginRightPercent
layout_marginBottomPercent
layout_marginStartPercent
layout_marginEndPercent
如何使用:
添加支持库到你的工程(Studio)
dependencies { compile 'com.android.support:percent:22.2.0'}
布局文件
PercentRelativeLayout
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <View android:id="@+id/top_left" android:layout_width="0dp" android:layout_height="0dp" android:layout_alignParentTop="true" android:background="#ff44aacc" app:layout_heightPercent="20%" app:layout_widthPercent="70%" /> <View android:id="@+id/top_right" android:layout_width="0dp" android:layout_height="0dp" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/top_left" android:background="#ffe40000" app:layout_heightPercent="20%" app:layout_widthPercent="30%" /> <View android:id="@+id/bottom" android:layout_width="match_parent" android:layout_height="0dp" android:layout_below="@+id/top_left" android:background="#ff00ff22" app:layout_heightPercent="80%" /></android.support.percent.PercentRelativeLayout>
GitHub示例:
https://github.com/JulienGenoud/android-percent-support-lib-sample
官方开发文档:
https://juliengenoud.github.io/android-percent-support-lib-sample/
1 0
- Android Percent Layout 安卓百分比布局
- android Percent百分比布局库
- Percent百分比布局--Android新布局
- android 百分比layout布局
- Android--百分比布局库(percent-support-lib)
- Android百分比布局Percent支持库
- Android 百分比布局库(percent-support-lib)
- Android 百分比布局(Percent Support Library)
- Android百分比布局Percent支持库
- Android百分比布局(percent-support-lib)
- Android 百分比布局库(percent-support-lib)
- android studio percent support librarys 百分比布局
- Android percent-support-lib百分比布局
- Percent百分比布局用法
- 安卓 百分比布局
- 安卓百分比布局
- Android百分比布局支持库 com.android.support:percent
- Android百分比布局支持库(android-percent-support)
- handler传递
- 嵌入式Linux启动过程中的问题积累
- 接口和扩展
- 黑帽SEO
- 谷歌Volley网络框架讲解——网络枢纽
- Android Percent Layout 安卓百分比布局
- Ryu基本操作的REST API调用示例
- android 项目R.java文件缺失导致编译错误
- VMware、RHEL的网络配置
- AppDelegate中几个惯用的回调调用时机
- CocoaPods pod install/pod update更新慢的问题
- 查看Linux系统版本,适用于RedHat,CentOS
- 谷歌Volley网络框架讲解——Network及其实现类
- SDN交换机的拓扑发现与ARP处理