<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
- Flexboxlayout 5大布局属性之-justifyContent
1、flex_start(默认值):左对齐
2、flex-end:右对齐
3、center: 居中
4、space-between:两端对齐,控件之间的间隔相等
5、space-around:每个控件距离两侧的间隔相等(项目之间的间隔比项目与边框的间隔大一倍)
详细对应的属性如下:
1、flex_start(默认值):左对齐
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:justifyContent=“flex_start”>
<TextView
android:layout_width=“80dp”
android:layout_height=“80dp”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex_start(默认值):左对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
2、flex-end:右对齐
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:justifyContent=“flex_end”>
<TextView
android:layout_width=“80dp”
android:layout_height=“80dp”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex-end:右对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
3、center: 居中
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:justifyContent=“center”>
<TextView
android:layout_width=“80dp”
android:layout_height=“80dp”
android:gravity=“center”
android:padding=“5dp”
android:text=“center: 居中” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
4、space-between:两端对齐,控件之间的间隔相等
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:justifyContent=“space_between”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“space-between:两端对齐,控件之间的间隔相等” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
5、space-around:每个控件距离两侧的间隔相等(项目之间的间隔比项目与边框的间隔大一倍)
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:justifyContent=“space_around”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“space-around:每个控件距离两侧的间隔相等(项目之间的间隔比项目与边框的间隔大一倍)” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
- Flexboxlayout 5大布局属性之-alignItems
1、stretch(默认值):如果项目未设置高度或设为auto,将占满整个容器的高度。
2、flex-start:左上方开始,并与左上方对齐
3、flex-end:左下方开始,并与左下方对齐
4、center:左控件的中间开始,并与中心线水平对齐
5、baseline: 控件中的文字向上对齐
详细对应的属性如下:
1、stretch(默认值):如果项目未设置高度或设为auto,将占满整个容器的高度。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“stretch”>
<TextView
android:layout_width=“80dp”
android:layout_height=“80dp”
android:gravity=“center”
android:padding=“5dp”
android:text=“stretch(默认值):如果项目未设置高度或设为auto,将占满整个容器的高度。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
</com.google.android.flexbox.FlexboxLayout>
2、flex-start:左上方开始,并与左上方对齐
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“flex_start”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex-start:左上方开始,并与左上方对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
3、flex-end:左下方开始,并与左下方对齐
效果图中:应为flex-end(在这里就不换图了,明白就好)
<?xml version="1.0" encoding="utf-8"?><FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“flex_end”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex-end:左下方开始,并与左下方对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
4、center:左控件的中间开始,并与中心线水平对齐
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“center”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“center:左控件的中间开始,并与中心线水平对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
5、baseline: 控件中的文字向上对齐
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“baseline”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:background=“@color/colorAccent”
android:gravity=“center”
android:padding=“5dp”
android:text=“baseline: 控件中的文字向上对齐” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
- Flexboxlayout 5大布局属性之-alignContent
1、stretch(默认值):占满整个父控件。
2、flex-start:与左上角对齐。
3、flex-end:与左下角对齐。
4、center:居中对齐。
5、space_between:两端对齐。
6、space_around:控件两侧的间隔都相等(所以控件到控件距离是边上的2倍)
详细对应的属性如下:
1、stretch(默认值):占满整个父控件。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“stretch”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“stretch(默认值):占满整个父控件。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
2、flex-start:与左上角对齐。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“flex_start”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex-start:与左上角对齐。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
3、flex-end:与左下角对齐。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“flex_end”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“flex-end:与左下角对齐。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
4、center:居中对齐。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“center”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“center:居中对齐。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
5、space_between:两端对齐。
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“space_between”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“space_between:两端对齐。” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
6、space_around:控件两侧的间隔都相等(所以控件到控件距离是边上的2倍)
<FrameLayout 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”>
<com.google.android.flexbox.FlexboxLayout
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“space_around”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“space_around:控件两侧的间隔都相等(所以控件到控件距离是边上的2倍)” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5” />
</com.google.android.flexbox.FlexboxLayout>
- 元素的权重
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”>
<TextView
android:layout_width=“0dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“layout_flexGrow(表示元素的权重属性)”
app:layout_flexGrow=“2” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“0dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1”
app:layout_flexGrow=“1” />
</com.google.android.flexbox.FlexboxLayout>
- 空间不足时子控件的缩放比例
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“300dp”
android:layout_height=“wrap_content”>
<TextView
android:layout_width=“300dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“因为宽度不足,所以text1就缩小三分之二,text2缩小三分之一。”
app:layout_flexShrink=“2” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“300dp”
android:layout_height=“wrap_content”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1”
app:layout_flexShrink=“1” />
</com.google.android.flexbox.FlexboxLayout>
- 控制排列的顺序
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“layout_order(控制排列的顺序,按照从小到大的顺序依次排列)”
app:layout_order=“1” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1”
app:layout_order=“6” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2”
app:layout_order=“5” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3”
app:layout_order=“4” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4”
app:layout_order=“3” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5”
app:layout_order=“2” />
</com.google.android.flexbox.FlexboxLayout>
- 百分比布局
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:flexWrap=“wrap”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:gravity=“center”
android:padding=“5dp”
android:text=“layout_flexBasisPercent(按照横轴的百分比进行布局)”
app:layout_flexBasisPercent=“30%” />
<TextView
android:id=“@+id/textview1”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#ff0202”
android:gravity=“center”
android:padding=“5dp”
android:text=“textview1”
app:layout_flexBasisPercent=“50%” />
<TextView
android:id=“@+id/textview2”
android:layout_width=“60dp”
android:layout_height=“80dp”
android:background=“#ffc402”
android:gravity=“center”
android:text=“textview2”
app:layout_flexBasisPercent=“50%” />
<TextView
android:id=“@+id/textview3”
android:layout_width=“80dp”
android:layout_height=“80dp”
android:background=“#06ff02”
android:gravity=“center”
android:text=“textview3”
app:layout_flexBasisPercent=“50%” />
<TextView
android:id=“@+id/textview4”
android:layout_width=“90dp”
android:layout_height=“80dp”
android:background=“#02c8ff”
android:gravity=“center”
android:text=“textview4”
app:layout_flexBasisPercent=“50%” />
<TextView
android:id=“@+id/textview5”
android:layout_width=“100dp”
android:layout_height=“80dp”
android:background=“#022cff”
android:gravity=“center”
android:text=“textview5”
app:layout_flexBasisPercent=“50%” />
</com.google.android.flexbox.FlexboxLayout>
- 单元素位置属性
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignItems=“flex_start”>
<TextView
android:layout_width=“80dp”
android:layout_height=“wrap_content”
android:background=“#05f20d”
android:gravity=“center”
android:padding=“5dp”
android:text=“layout_alignSelf(允许单个子元素有与其他子元素不一样的对齐方式,可覆盖 alignItems 属性。默认值为auto)” />
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#0534f2”
android:gravity=“center”
android:text=“text1”
android:textColor=“#ffffff”
app:layout_alignSelf=“center” />
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#f20505”
android:gravity=“center”
android:text=“text2”
app:layout_alignSelf=“flex_end” />
</com.google.android.flexbox.FlexboxLayout>
- 分割线
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“space_around”
app:flexWrap=“wrap”>
<com.google.android.flexbox.FlexboxLayout
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
app:dividerDrawableHorizontal=“@drawable/ic_remove_black_24dp”
app:showDividerHorizontal=“beginning”>
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#f2ea05”
android:gravity=“center”
android:text=“text2”
android:textColor=“#ffffff” />
</com.google.android.flexbox.FlexboxLayout>
<com.google.android.flexbox.FlexboxLayout
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

【附】相关架构及资料
源码、笔记、视频。高级UI、性能优化、架构师课程、NDK、混合式开发(ReactNative+Weex)微信小程序、Flutter全方面的Android进阶实践技术,和技术大牛一起讨论交流解决问题。
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
性。默认值为auto)" />
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#0534f2”
android:gravity=“center”
android:text=“text1”
android:textColor=“#ffffff”
app:layout_alignSelf=“center” />
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#f20505”
android:gravity=“center”
android:text=“text2”
app:layout_alignSelf=“flex_end” />
</com.google.android.flexbox.FlexboxLayout>
- 分割线
<com.google.android.flexbox.FlexboxLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:id=“@+id/flexbox_layout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
app:alignContent=“space_around”
app:flexWrap=“wrap”>
<com.google.android.flexbox.FlexboxLayout
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
app:dividerDrawableHorizontal=“@drawable/ic_remove_black_24dp”
app:showDividerHorizontal=“beginning”>
<TextView
android:layout_width=“100dp”
android:layout_height=“100dp”
android:background=“#f2ea05”
android:gravity=“center”
android:text=“text2”
android:textColor=“#ffffff” />
</com.google.android.flexbox.FlexboxLayout>
<com.google.android.flexbox.FlexboxLayout
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-yES27rlg-1712443839746)]
[外链图片转存中…(img-akMvO0A5-1712443839746)]
[外链图片转存中…(img-bzYfn9cl-1712443839746)]
[外链图片转存中…(img-3XZP09Vp-1712443839747)]
[外链图片转存中…(img-bnAkWurO-1712443839747)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

【附】相关架构及资料
源码、笔记、视频。高级UI、性能优化、架构师课程、NDK、混合式开发(ReactNative+Weex)微信小程序、Flutter全方面的Android进阶实践技术,和技术大牛一起讨论交流解决问题。
[外链图片转存中…(img-vb1n04Km-1712443839747)]
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!