A FlowLayout for Android, which allows child views flow to next row when there is no enough space. The spacing between child views can be calculated by the FlowLayout so that the views are evenly placed.
<com.nex3z.flowlayout.FlowLayout xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" app:childSpacing="auto" app:childSpacingForLastRow="align" app:rowSpacing="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SUN"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="MON"/> <!--...--> </com.nex3z.flowlayout.FlowLayout>
||The horizontal spacing between child views. Either
|The horizontal spacing between child views of the last row. Either
||The vertical spacing between rows. Either
auto means that the actual spacing is calculated as per the size of the
FlowLayout and the number of child views (or rows), so that the child views (or rows) are placed evenly.
childSpacingForLastRow means that the horizontal spacing of the child views in the last row keeps the same with the spacing used in the row above. If there is only one row in
FlowLayout and the
childSpacingForLastRow is set to
align, this value is ignored and the actual spacing is calculated using
Copyright 2016 nex3z Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.