Android 百分比布局

  • 添加依赖
  • 代码使用

添加依赖

implementation ‘com.android.support:percent:25.2.0’

我的项目是AndroidX的,依然用这个依赖哦~

代码使用

<androidx.percentlayout.widget.PercentFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".activitys.PercentActivity"><Buttonapp:layout_widthPercent="50%"app:layout_heightPercent="50%"/><Buttonandroid:layout_gravity="right"app:layout_widthPercent="50%"app:layout_heightPercent="50%"/><Buttonandroid:color="#16F145"android:layout_gravity="bottom"app:layout_widthPercent="50%"app:layout_heightPercent="50%"/><Buttonandroid:color="#F44336"android:layout_gravity="right|bottom"app:layout_widthPercent="50%"app:layout_heightPercent="50%"/>
</androidx.percentlayout.widget.PercentFrameLayout>
  • app:layout_widthPercent = " %" 设置宽度百分比
  • app:layout_heightPercent = " %" 设置高度百分比

效果图(1.1):

原创不易,您的点赞就是对我最大的支持o~

Android 百分比布局(支持AndroidX)相关推荐

  1. Android百分比布局支持和垂直TextView

    In this tutorial, we'll discuss and implement Android Percent Layout Support Library. Furthermore, w ...

  2. android百分比布局失效,Android 百分比布局库【原创】

    为了解决android手机适配问题,我们经常想如果可以按照百分比的方式进行界面布局,这样适配各种屏幕就简单多了吧!现在谷歌正式提供百分比布局支持库(android-support-percent-li ...

  3. android 边距 百分比,Android百分比布局:PercentRelativeLayout

     Android百分比布局:PercentRelativeLayout 在最新的Android support包中,增加了开发者期待的百分比布局PercentRelativeLayout和Perc ...

  4. android如何看百分比版本,【JAVA】Android百分比布局

    开发我人生第一个app的时候,我在想有没有这么一种布局能适应任何手机的分辨率,今天让我们一起来看看Android 百分比布局PercentRelativeLayout. 使用这种布局首先我们要在gra ...

  5. Android百分比布局初探

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u010046908/article/details/48802909 标题:Android百分比布局 ...

  6. Android 百分比布局

    Android 百分比布局库(percent-support-lib) 解析与扩展 扩展库github地址

  7. Android 百分比布局+ScrollView

    主要分为PercentRelativeLayout,和 PercentFrameLayout PercentRelativeLayout 一.添加依赖 compile 'com.android.sup ...

  8. Android 百分比布局、权重、隐藏TitleBar、引入自定义控件

    一.LinearLayout权重 1.1.android:layout_weight="1" 两个控件设置为1可以将屏幕等分为两份,更改数值可以根据各自数值各占有屏幕的尺寸    ...

  9. android rtl布局支持,Android 布局之 RTL

    Android 布局之 RTL 中东国家地区须要适配 RTL的布局,顾名思义支持从右至左布局android 前提:在AndroidManifest.xml文件中 android:supportsRtl ...

最新文章

  1. bp神经网络代码_精通数据科学笔记 神经网络
  2. 潘淳(寒树Office):不务正业的公众号满月了,都写了些啥?
  3. 牛客题霸 [子数组最大乘积] C++题解/答案
  4. 最大乘积(记忆化搜索)
  5. 神经网络特征图计算_GNNFiLM:基于线性特征调制的图神经网络
  6. elasticsearch 删除满足条件的语句_ElasticSearch的基本概念和集群分布式底层实现
  7. 计算机网络协议是网民们签订的合同,关于网络协议,下列__________选项是正确的。A.是网民们签订的合同B.是计算机之间的相互通信需...
  8. Luminus模板可选项
  9. Netty源码分析第8章(高性能工具类FastThreadLocal和Recycler)----第7节: 获取异线程释放的对象...
  10. java dateutils 今天_Java日期时间DateUtils工具包
  11. Word VBA-图片操作汇总
  12. 这可能是最简单易懂的机器学习入门(小白必读)
  13. 黑苹果El Captain 10.11.2 安装
  14. c15语言中不支持十六进制的数据,从十六进制字符串中提取数据
  15. ArcGIS中去除Z或M值的方法
  16. oracle lob函数,Oracle可以处理LOB字段的常用字符函数
  17. html分享到微博,h5页面分享到微信、朋友圈、新浪微博、QQ空间、QQ好友组件
  18. 市场调研报告-钨铜合金材料市场现状及未来发展趋势
  19. Windows7 开机自启脚本
  20. 猿创征文|2022年前端之路——我的前端开发好帮手

热门文章

  1. 如何有效建立客户关系,提高复购率与客户的终生价值
  2. android+曝光时间软件,Camera FV-5相机
  3. 虚拟机和物理机使用不同的键盘鼠标
  4. word在刷全文格式的时候,图片显示不全
  5. 为什么微信聊天记录不能云备份呢?
  6. 如何设置电脑关机后自动开机
  7. 【腾讯连连 腾讯物联网入门学习 第3篇】安信可IoT微信小程序全面开源,小程序上实现一键配网+控制+绑定!(源码开放)
  8. android挂断电话广播,android实现接通和挂断电话
  9. 【inpho精品教程】06 无人机数据预处理(导入Pix4D 空三成果)
  10. Spring Boot的配置文件加载优先级