百分比布局(PercentFrameLayout和PercentRelativeLayout)
来源:互联网 发布:暖通工程预算软件 编辑:程序博客网 时间:2024/05/21 22:24
1.使用百分比布局首先需要在build.gradle中添加依赖库
dependencies { …… compile 'com.android.support:percent:26.+'}2.布局文件(在这用的是PercentRelativeLayout百分比的相对布局)<?xml version="1.0" encoding="utf-8"?><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"> <Button android:id="@+id/btn1" android:text="w:20% h:10" android:textAllCaps="false" app:layout_widthPercent="20%" app:layout_heightPercent="10%"/> <Button android:id="@+id/btn2" android:text="w:40% h:10" app:layout_widthPercent="40%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn1"/> <Button android:id="@+id/btn3" android:text="w:60% h:10" android:textAllCaps="false" app:layout_widthPercent="60%" app:layout_heightPercent="10%" android:layout_below="@id/btn2"/> <Button android:id="@+id/btn4" android:text="w:80% h:10" app:layout_widthPercent="80%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn3"/> <Button android:id="@+id/btn5" android:text="w:100% h:10" app:layout_widthPercent="100%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn4"/> <Button android:id="@+id/btn6" android:text="w:80% h:10" app:layout_widthPercent="80%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn5"/> <Button android:id="@+id/btn7" android:text="w:60% h:10" app:layout_widthPercent="60%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn6"/> <Button android:id="@+id/btn8" android:text="w:40% h:10" app:layout_widthPercent="40%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn7"/> <Button android:id="@+id/btn9" android:text="w:20% h:10" app:layout_widthPercent="20%" app:layout_heightPercent="10%" android:textAllCaps="false" android:layout_below="@id/btn8"/></android.support.percent.PercentRelativeLayout>
阅读全文
0 0
- 百分比布局(PercentFrameLayout和PercentRelativeLayout)
- android 百分比布局percentFrameLayout,percentRelativeLayout的使用
- PercentFrameLayout和PercentRelativeLayout
- Android百分比布局:PercentFrameLayout
- Android百分比布局:PercentFrameLayout
- Android百分比布局:PercentRelativeLayout
- 百分比布局PercentRelativeLayout
- PercentRelativeLayout百分比布局
- Android百分比布局:PercentRelativeLayout
- android百分比布局PercentRelativeLayout
- android 5.0+原生质设计,cardview、Recyclerview、百分比布局PercentRelativeLayout简单使用
- Android界面百分比适配-PercentRelativeLayout
- PercentRelativeLayout
- 百分比布局
- 百分比布局
- 百分比布局
- 百分比布局
- 百分比布局
- Django(三)--First Project
- 安装禅道的基本步骤
- 数据对齐
- 【LeetCode】53.Maximum Subarray
- LeetCode 485. Max Consecutive Ones
- 百分比布局(PercentFrameLayout和PercentRelativeLayout)
- 在 Ubuntu 14.04/15.04 上安装配置 Node.js v4.0.0
- Oracle数据库与MySQL数据库的区别
- 使用Tampermonkey进行JavaScript编程
- 11:回文素数( 1.13编程基础之综合应用)
- JVM类加载原理学习笔记
- 仿今日的横排滑动
- 记录下CVTE一面,还有点别的想说的
- 数据库三大范式