android 百分比布局percentFrameLayout,percentRelativeLayout的使用
来源:互联网 发布:阿里云速度 编辑:程序博客网 时间:2024/05/22 08:04
这种布局方式是google新添加的一种布局,需要引入安卓的support兼容包,这个包大家都很清楚,一般android的新特效新功能都会在support包中。
我们知道。在安卓的布局中,只有LinearLayout才支持设置权重weight来按比例划分控件的大小,其他布局都不支持这种方式,这就显得,有时候我们一些复杂点的布局搞起来就有点繁琐。
为此,android引入了一种全新的布局方式来解决这个问题,---百分比布局,简单的理解就是在这个布局的控件可以设置百分比啦,很高大上有木有,,,,
1.引入
compile'com.android.support:percent:24.2.1'
2.新建一个layout文件
<?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"> <Button android:text="1" android:layout_gravity="left|top" app:layout_widthPercent="50%" app:layout_heightPercent="50%" /> <Button android:text="2" android:layout_gravity="right|top" app:layout_widthPercent="50%" app:layout_heightPercent="50%" /> <Button android:text="3" android:layout_gravity="left|bottom" app:layout_widthPercent="50%" app:layout_heightPercent="50%" /> <Button android:text="4" android:layout_gravity="right|bottom" app:layout_widthPercent="50%" app:layout_heightPercent="50%" /></android.support.percent.PercentFrameLayout>我们可以看到,这里多了两个新属性---
app:layout_widthPercent="50%"app:layout_heightPercent="50%"这就是指定我们的控件和父布局的百分之50.上图
阅读全文
0 0
- android 百分比布局percentFrameLayout,percentRelativeLayout的使用
- 百分比布局(PercentFrameLayout和PercentRelativeLayout)
- Android百分比布局:PercentFrameLayout
- Android百分比布局:PercentFrameLayout
- Android百分比布局:PercentRelativeLayout
- Android百分比布局:PercentRelativeLayout
- android百分比布局PercentRelativeLayout
- 百分比布局PercentRelativeLayout
- PercentRelativeLayout百分比布局
- android 5.0+原生质设计,cardview、Recyclerview、百分比布局PercentRelativeLayout简单使用
- PercentFrameLayout和PercentRelativeLayout
- Android百分比布局的使用
- Android界面百分比适配-PercentRelativeLayout
- Android 百分比布局库的使用
- PercentRelativeLayout 的使用
- 百分比布局的使用
- 百分比布局的使用
- 百分比布局的使用
- Appium中xpath的使用
- 『ORACLE』DG搭建时备库的db_name报错(11g)
- Linux用户必看:29个必须掌握的常用命令
- 深度学习(五十七)tensorflow andorid yolo物体检测测试
- C++学习笔记(二)
- android 百分比布局percentFrameLayout,percentRelativeLayout的使用
- MySQL: Fabric 搭建 HA
- 异常
- opencv function "imread" and loaded image depth concept
- Incorrect string value: '\xF0\x9F\x90\x9D</...' for column 'content' at row 1
- tf.train.NewCheckpointReader实现保存变量的提取
- C++程序内存分配中set_new_handler…
- git的使用,精细篇
- phpcms v9网站搬家的方法(含域名更改)