Android弹性收缩自适应布局FlexboxLayout
Android弹性收缩自适应布局FlexboxLayout
其在github上的项目主页:https://github.com/google/flexbox-layout
使用前先添加引用:
dependencies {
implementation 'com.google.android:flexbox:0.3.2'
}
写一个布局演示:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.flexbox.FlexboxLayout 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"
app:alignContent="flex_start"
app:flexDirection="row"
app:flexWrap="wrap"
app:justifyContent="flex_start">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang"
android:textColor="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="phil"
android:textColor="@android:color/white"
app:layout_flexGrow="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang phil"
android:textColor="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="csdn"
android:textColor="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang phil 3"
android:textColor="@android:color/white"
app:layout_order="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang phil 2"
android:textColor="@android:color/white"
app:layout_order="2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang phil 1"
android:textColor="@android:color/white"
app:layout_order="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="zhang phil @ csdn"
android:textColor="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:text="https://blog.csdn.net/zhangphil"
android:textColor="@android:color/white" />
</com.google.android.flexbox.FlexboxLayout>
代码运行结果输出:
app:layout_order
默认值是1,值越小,越靠前排列,越大,越排到后面。

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
格安菲移动宣布更名为“别开生面移动科技” 本地化迈出关键一步
领先的加拿大Android虚拟化平台供应商格安菲移动科技Graphite Software宣布将其中文名称更改为“别开生面移动科技”, 并将使用新的品牌标识(如下图所示) ,之前的产品名称“安全空间”也将被同步取代。重塑品牌是公司在中国本土市场扩张计划的重要组成部分,更名可以更好地传达公司的价值主张,是品牌重塑的具体体现,为此,公司还聘请了前奥美高管段培力博士担任CMO领导市场变革。 “别开生面”作为中国家喻户晓的成语,意味着打开一个全新视界,它恰如其分地描述了公司产品在Android设备上的价值体现。 对于用户而言,下载一个“别开生面”空间,就像多拥有了一部手机,但只需要携带原来的硬件设备,并且每个“别开生面”空间的应用和数据互相隔离,能够对隐私进行安全保护。每一个“别开生面”空间都是一个Android虚拟化平台,单台设备上可共存多个空间, 空间之间可无缝切换。 “移动设备的虚拟空间解决方案适合多种场景,我们的目标是最大化发挥‘别开生面’解决方案的价值,超越企业市场,进入消费市场,如儿童空间和游戏空间等。同时,采用中文名称也表明我们扎根本土、服务国市场的决心,”格安菲CMO段培力这样...
-
下一篇
Android 8.0 下载安装进入【安装未知应用】页面,两步简化一步
小菜昨天接到客户反馈的问题,说华为手机升级到 Android 8.0 系统以后,程序升级下载之后不能安装;找一个手机测试果然如此,每次下载完之后不跳转安装页面,重新进入程序又继续下载,之后依旧不跳转安装页面,再次进入循环...流程自然欠妥,但发现问题主要还是 Android8.0 权限管理的问题。 在 Android 8.0 系统中,未知来源应用不可直接安装,跳转到的是未知来源应用管理列表,如果需要安装,则需要手动授权"安装未知应用"。 网上大神们解决方案很多,基本一致,但小菜尝试发现每次安装跳转到【安装未知应用列表】页面,之后找到相应的应用,进入【安装未知应用】页面,再手动允许安装应用,小菜想弹框提醒一步允许安装,尝试如下: 权限添加,在 AndroidManifest.xml 清单文件中,添加如下权限; <users-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> 在【打开安装包】的代码中添加兼容 Android 8.0 的代码判断; private void notify...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- SpringBoot2更换Tomcat为Jetty,小型站点的福音
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7
- CentOS7,8上快速安装Gitea,搭建Git服务器
- MySQL8.0.19开启GTID主从同步CentOS8
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- Dcoker安装(在线仓库),最新的服务器搭配容器使用
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Docker快速安装Oracle11G,搭建oracle11g学习环境