Android Percentlayout百分比布局
来源:互联网 发布:贵州浪人网络投诉 编辑:程序博客网 时间:2024/06/07 09:21
均支持以下属性:
· layout_widthPercent
· layout_heightPercent
· layout_marginPercent
· layout_marginLeftPercent
· layout_marginTopPercent
· layout_marginRightPercent
· layout_marginBottomPercent
· layout_marginStartPercent
· layout_marginEndPercent
效果图:
如何使用:
添加支持库到你的工程(Studio)
[java] view plain copy
- dependencies {
- compile 'com.android.support:percent:22.2.0'
- }
布局文件
PercentRelativeLayout
[html] view plain copy
- <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/
简单实用
阅读全文
0 0
- Android Percentlayout百分比布局
- android 百分比布局(percentLayout),妈妈再也不用担心适配问题了
- Android 支持百分比布局
- Android支持百分比布局
- Android百分比布局初探
- Android百分比布局:PercentRelativeLayout
- Android百分比布局:PercentFrameLayout
- Android 百分比布局
- android 百分比layout布局
- Android百分比布局
- android 百分比布局
- Android 百分比布局库
- Android 百分比布局揭秘
- Android 自定义百分比布局
- Android百分比布局
- android中的百分比布局
- Android百分比布局:PercentFrameLayout
- Android百分比布局:PercentRelativeLayout
- [线段树][单调栈]HackerRank 101 Hack 50 .Boxes for Toys
- 水题 第一站 精挑细选
- 网页插入视频&用图片做超链接
- 行优先存储和列优先存储
- selenium中级教程
- Android Percentlayout百分比布局
- Hadoop基础教程-第9章 HA高可用(9.2 HDFS 高可用配置)(草稿)
- 洛谷 红魔馆OI 妖梦斩木棒
- centos7.2使用rpm安装jdk8
- html第二天的学习
- TCP协议特点和3次握手
- POJ 1416 Shredding Company <DFS>
- Set的命令介绍与代码剖析笔记(7)
- JAVA电话簿