1.百分比布局

很简单,超级简单。引用之后就可以使用了。

compile 'com.android.support:percent:23+'

git地址:

https://github.com/JulienGenoud/android-percent-support-lib-sample.git

注意:使用的时候,百分比布局只对他包含的一级有用。就是直属子布局有用。上代码:

<?xml version="1.0" encoding="utf-8"?>
<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">
<com.google.android.flexbox.FlexboxLayout
xmlns:fle="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_heightPercent="80%"
app:layout_widthPercent="80%"
android:background="@color/colorAccent"
app:flexWrap="wrap"
app:alignItems="flex_start"
app:alignContent="flex_start" >
<android.support.percent.PercentFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="0dp"
android:text="aaaasdfsadfasdfsa"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%"
android:layout_height="0dp" /> </android.support.percent.PercentFrameLayout> <android.support.percent.PercentFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="0dp"
android:text="aaaasdfsadfasdfsa"
app:layout_heightPercent="20%"
app:layout_widthPercent="20%"
android:layout_height="0dp" /> </android.support.percent.PercentFrameLayout>
</com.google.android.flexbox.FlexboxLayout>
</android.support.percent.PercentFrameLayout>

也就是说只能对她的直属下一级起作用。

2.弹性布局:

compile 'com.google.android:flexbox:0.1.3'

git:

https://github.com/google/flexbox-layout.git

Android 布局开发之百分比布局、弹性布局的更多相关文章

  1. HTML5-移动开发常用技巧与弹性布局的使用

    一.移动开发常用技巧 Viewport基本知识 设置布局Viewport的各种信息 1.width=device-width: 设置Viewport视口宽度等于设备宽度 2.initial-scale ...

  2. 【Android应用开发技术:用户界面】布局管理器

    作者:郭孝星 微博:郭孝星的新浪微博 邮箱:allenwells@163.com 博客:http://blog.csdn.net/allenwells Github:https://github.co ...

  3. 从零开始学习前端开发 — 12、CSS3弹性布局

    一.分栏布局 1.设置栏数column-count:数值; 2.设置每栏的宽度column-width:数值+单位; 注:当设置了column-width,column-count会失效,二者设置其一 ...

  4. 【Android 应用开发】AndroidUI设计之 布局管理器 - 详细解析布局实现

    写完博客的总结 : 以前没有弄清楚的概念清晰化 父容器与本容器属性 : android_layout...属性是本容器的属性, 定义在这个布局管理器的LayoutParams内部类中, 每个布局管理器 ...

  5. React Native 弹性布局FlexBox

    React Native采用一中全新的布局方式:FlexBox(弹性布局).可以很方便的实现各种复杂布局,是全新的针对web和移动开发布局的一种实现方式. 何为FlexBox? 完整名称为:the f ...

  6. ch8 固定宽度、流式、弹性布局

    假设浏览器窗口设置为1250px:wrapper的宽度为960px:content的宽度为920px:确保了wrapper居中时两边有20px的间距:  secondary的宽度为230px:  pr ...

  7. 记一下flex弹性布局

    flex弹性布局也越来越广泛的在我们代码中出现了,更加方便我们的布局.自己用了查,查了用,有些还是记不住,俗话说好脑子不如烂笔头,原来都是写在本子上的,很不幸的一次次的想翻的时候总是找不到,还是写博客 ...

  8. flex弹性布局的基本介绍

    最近开始做元素排列比较复杂的项目,同时需要各种型号手机的适配,我发现以前所掌握的盒子模型.display.position.float等已经不能满足我的需求了, 于是开始着重学习flex弹性布局并运用 ...

  9. css3弹性布局

    二.弹性布局(重点******************************************) 1.什么是弹性布局 弹性布局,是一种布局方式. 主要解决的是某个元素中子元素的布局方式 让页面 ...

随机推荐

  1. SAP ECC6.0-中建信息版

    平台: SUSE Enterprise Server 类型: 虚拟机镜像 软件包: sap ecc 6.0 ehp7 sps10 commercial erp sap 服务优惠价: 按服务商许可协议 ...

  2. 用户管理的设计--4.jquery的ajax实现登录名的校验

    页面效果 鼠标失去焦点时,不需要刷新页面进行校验,判断登录名是否重复. 实现步骤 1.引入struts2-json-plugin-2.5.10.1插件包 2.页面使用jquery的ajax实现后台校验 ...

  3. Selenium入门12 鼠标和键盘事件

    1 鼠标 集成在webdriver.ActionChains.单击.双击.右击.拖放等等.   2 键盘 引入包from selenium.webdriver.common.keys import K ...

  4. 线程属性总结 线程的api属性

    http://blog.csdn.net/zsf8701/article/details/7842392 //线程属性结构如下:typedef struct{ int etachstate; //线程 ...

  5. LA 3708 墓地雕塑

    题目链接:https://vjudge.net/contest/132704#problem/D 题意:一个长度为10000的园上,均匀分布n个雕塑,现在要加入m个雕塑,这样原先的就可能会移动,求移动 ...

  6. 【转】Android UI开发第二十四篇——Action Bar

    Action bar是一个标识应用程序和用户位置的窗口功能,并且给用户提供操作和导航模式.在大多数的情况下,当你需要突出展现用户行为或全局导航的activity中使用action bar,因为acti ...

  7. 剑指offer 33 把数组排成最小的数

    错误代码 class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { int length = ...

  8. 剑指offer40

    class Solution { public: void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) { ) ret ...

  9. PASCAL VOC数据集分析

    http://blog.csdn.net/zhangjunbob/article/details/52769381

  10. spring boot1.5.6 测试类

    package com.qutaoyao.demo.web; import com.qutaoyao.demo.web.controller.HelloController;import org.ju ...