Android 布局开发之百分比布局、弹性布局
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'
Android 布局开发之百分比布局、弹性布局的更多相关文章
- HTML5-移动开发常用技巧与弹性布局的使用
一.移动开发常用技巧 Viewport基本知识 设置布局Viewport的各种信息 1.width=device-width: 设置Viewport视口宽度等于设备宽度 2.initial-scale ...
- 【Android应用开发技术:用户界面】布局管理器
作者:郭孝星 微博:郭孝星的新浪微博 邮箱:allenwells@163.com 博客:http://blog.csdn.net/allenwells Github:https://github.co ...
- 从零开始学习前端开发 — 12、CSS3弹性布局
一.分栏布局 1.设置栏数column-count:数值; 2.设置每栏的宽度column-width:数值+单位; 注:当设置了column-width,column-count会失效,二者设置其一 ...
- 【Android 应用开发】AndroidUI设计之 布局管理器 - 详细解析布局实现
写完博客的总结 : 以前没有弄清楚的概念清晰化 父容器与本容器属性 : android_layout...属性是本容器的属性, 定义在这个布局管理器的LayoutParams内部类中, 每个布局管理器 ...
- React Native 弹性布局FlexBox
React Native采用一中全新的布局方式:FlexBox(弹性布局).可以很方便的实现各种复杂布局,是全新的针对web和移动开发布局的一种实现方式. 何为FlexBox? 完整名称为:the f ...
- ch8 固定宽度、流式、弹性布局
假设浏览器窗口设置为1250px:wrapper的宽度为960px:content的宽度为920px:确保了wrapper居中时两边有20px的间距: secondary的宽度为230px: pr ...
- 记一下flex弹性布局
flex弹性布局也越来越广泛的在我们代码中出现了,更加方便我们的布局.自己用了查,查了用,有些还是记不住,俗话说好脑子不如烂笔头,原来都是写在本子上的,很不幸的一次次的想翻的时候总是找不到,还是写博客 ...
- flex弹性布局的基本介绍
最近开始做元素排列比较复杂的项目,同时需要各种型号手机的适配,我发现以前所掌握的盒子模型.display.position.float等已经不能满足我的需求了, 于是开始着重学习flex弹性布局并运用 ...
- css3弹性布局
二.弹性布局(重点******************************************) 1.什么是弹性布局 弹性布局,是一种布局方式. 主要解决的是某个元素中子元素的布局方式 让页面 ...
随机推荐
- android三大组件之Intent
Android 应用程序中有三大核心组件: Activity, Service, Broadcast Receiver 都是通过被称之为意图的消息运行. Intent messaging is a f ...
- C# 对XML操作-实例
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- Visual Studio 各个版本汇总
微软开发人员,对开发工具的熟练程度,在一定程度上说明了开发 版本 名称 内部版本 发布日期 支持 .NET Framework 版本 备注 引入 .NET Framework 前[4] 1 Visu ...
- [转]Android中Spinner下拉列表(使用ArrayAdapter和自定义Adapter实现)
今天学习了Spinner组件,使用Spinner相当于从下拉列表中选择项目,下面演示一下Spinner的使用(分别使用ArrayAdapter和自定义Adapter实现) (一):使用ArrayAda ...
- 关于HTML5,最牛逼的10本书!
关于HTML5,最牛逼的10本书! 关于HTML5,最牛逼的10本书.rar HTML5+CSS3从入门到精通 李东博 著 推荐指数:★★★☆ 简介:本书通过基础知识+中小实例+综合案例的方式,讲述了 ...
- cs231n 17-18 assignment2 出现 No module named 'past' 解决方法
解决方法: pip install future
- 【转】android布局--Android fill_parent、wrap_content和match_parent的区别
三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便. 1)fill_parent 设置一个构件的布局为fill_parent将强制性地使构件扩展,以 ...
- gearmand安装过程
51 cd boost_1_53_0 52 tail -f build_log 53 dir 54 cd gearmand-1.1.8 55 ./configure 56 could not find ...
- 问题 C: P4 游戏中的Human角色
题目描述 在一个平面打斗游戏中,任何的角色(Role)都有血量(blood)和位置loc(此处loc是Location类的实例)属性.有了Role类,可以派生出不同的角色,如人.神仙.怪兽等.如下程序 ...
- wordpress问题集锦
1.内容不自动换行 找到对应的样式,添加如下代码,width根据具体情况修改. width:640px;white-space:normal;word-break:break-all;word-wra ...