推荐android布局百分比框架
githup:https://github.com/JulienGenoud/android-percent-support-lib-sample
下面是使用方法:
Android Percent Support Lib Sample 


I made a sample of the new percent support library.
You can check official docs reference here and here.
This library provide percentage based layouts, horizontal and vertical at the same time.
simple result

complex result

How to use :
just add percent support library to your project
dependencies {
compile 'com.android.support:percent:25.3.0'
}
###Supported Layouts :
####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>
####PercentLinearLayout
<com.juliengenoud.percentsamples.PercentLinearLayout
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"
android:orientation="vertical">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ff44aacc"
app:layout_heightPercent="10%"
app:layout_widthPercent="60%"/> <View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ff4400cc"
app:layout_heightPercent="10%"
app:layout_widthPercent="70%"/>
</com.juliengenoud.percentsamples.PercentLinearLayout>
####PercentFrameLayout
<android.support.percent.PercentFrameLayout
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">
<!-- ... XML CODE -->
</android.support.percent.PercentFrameLayout>
简单明了。
推荐android布局百分比框架的更多相关文章
- Android 布局
转自:http://www.cnblogs.com/chiao/archive/2011/08/24/2152435.html Android布局是应用界面开发的重要一环,在Android中,共有五种 ...
- Android图片载入框架最全解析(一),Glide的基本使用方法
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/53759439 本文同步发表于我的微信公众号.扫一扫文章底部的二维码或在微信搜索 郭 ...
- 各种Android UI开源框架 开源库
各种Android UI开源框架 开源库 转 https://blog.csdn.net/zhangdi_gdk2016/article/details/84643668 自己总结的Android开源 ...
- Android布局方式总结
Android的布局分别是:线性布局LinearLayout.相对布局RelativeLayout.帧布局FrameLayout.网格布局GridLayout.约束布局ConstraintLayout ...
- Android开源测试框架学习
近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...
- Android 网络请求框架android-async-http问题
今天通过接口请求服务器的一些app数据,发现一个很奇怪的问题,请求一个链接的时候,通常在第一次请求发起的时候没有什么问题,能很快的拿到数据,但是 往后再去请求的时候就会等待很久,而且最后会请求失败,一 ...
- 【转】Android布局优化之ViewStub
ViewStub是Android布局优化中一个很不错的标签/控件,直接继承自View.虽然Android开发人员基本上都听说过,但是真正用的可能不多. ViewStub可以理解成一个非常轻量级的Vie ...
- 详解Android首选项框架ListPreference
详解Android首选项框架ListPreference 原文地址 探索首选项框架 在深入探讨Android的首选项框架之前,首先构想一个需要使用首选项的场景,然后分析如何实现这一场景.假设你正在编写 ...
- 五大Android布局方式浅析
Android布局是应用界面开发的重要一环,在Android中,共有五种布局方式,分别是:FrameLayout(框架布局),LinearLayout (线性布局),AbsoluteLayout(绝对 ...
随机推荐
- centos安装postgresql-10及操作
安装postgresql: Linux启动: service postgresql start 创建用户: createuser username 创建数据库: createdb dbname -O ...
- 分享 | 自定义属于自己的U盘图标
文章目录 步骤 注意 想不想也可以自定义自己的U盘图标?其实,这并不难 步骤 在网上下载ICO格式的图标,也可以将自己喜欢的图片转换成ICO格式,并将图片命名为demo.ico: 点击这里打开记事本, ...
- (转)秒杀系统中如何动态生成下单随机URL
秒杀系统中通常会避免用户之间访问下单页面的URL(避免使用爬虫来造成不公平).所有需要将URL动态化,即使秒杀系统的开发人员也无法在知晓在秒杀开始时的URL.解决办法是在获取秒杀URL的接口中,返回一 ...
- hdu2846 Repository
//--------------------------------------------------------------- /*---字典树应用问题.考虑到要查询的次数在10^6,显然直接插入 ...
- 6、Python模块
最常用的两个模块: os #可以允许python调用执行系统命令,如shell sys #处理与python程序本身的事情 Python自带200多个常用模块 Python官网收集了2 ...
- linux stdin(0)/ stdout(1) / stderr(2)
在shell中,每个进程都和三个系统文件相关联:标准输入stdin,标准输出stdout.标准错误stderr,三个系统文件的文件描述符分别为0,1.2.进程需要的输入来自stdin文件.进程的标准输 ...
- RSA加密解密及数字签名Java实现
http://my.oschina.net/jiangli0502/blog/171263
- 【Java】String和Date、Timestamp之间的转换
首先,定义一个Format的日期格式: SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 一.S ...
- 倍福TwinCAT(贝福Beckhoff)基础教程2.1 TwinCAT常见类型简介
常见数据类型可以参考EXCEL表格的内容,在准备值中输入非法数据,然后回车会有错误提示(例如BYTE数据输入256) 右击可以切换二进制或十进制显示,wData5可以被挨个采集每个位上的数据,也可 ...
- const 使用方法具体解释
const使用方法具体解释 面向对象是C++的重要特性. 可是c++在c的基础上新添加的几点优化也是非常耀眼的 就const直接能够代替c中的#define 下面几点非常重要,学不好后果也也非常严重 ...