flexboxlayout

FlexboxLayout的使用

匿名 (未验证) 提交于 2019-12-03 00:19:01
FlexboxLayout 本文是 官方文档 的翻译 FlexboxLayout 是一个库项目,能在Android上实现类似 CSS Flexible Box Layout Module 的能力。 添加以下依赖到你的 build.gradle 文件中: dependencies { implementation 'com.google.android:flexbox:1.0.0' } 在布局中有两种方式使用FlexBox FlexboxLayout 第一种是像 LinearLayout 和 RelativeLayout 那样, FlexboxLayout 都是继承了 ViewGroup 。 你可以指定属性在一个布局XML,如: < 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:flexWrap = "wrap" app:alignItems = "stretch