The invention discloses a method for dynamically modifying initial positions of sub-assemblies in each row of a rolling
layout and spacing of the sub-assemblies, which comprises the following steps of: initializing a grid
layout manager, setting the number spanCount of each row and a longitudinal
layout direction according to a design drawing, and endowing Recycler View to the grid
layout manager; initializing the custom loop layout decorator, and inputting the parameters into the custom loop layout decorator; the method comprises the following steps of: endowing a user-defined cyclic layout decorator MyItemDecraft with Recycler View (Recycler View); the method comprises the following steps: executing a rendering process by a Recycler View of the Android; according to the method, a Recycler View is used, a grid
layout manager Grid
Layout Manager is set, and when the width of the Recycler View and the number of sub-assemblies in each row are fixed, rolling layout of a unique style can be achieved; the method comprises the following steps of: obtaining a specific offset of each sub-component which is modified when the sub-components are drawn in a
list through a self-defined loop layout decorator MyItemDecraft, and determining a drawing area corresponding to each sub-component through the offset, namely, the width of Recycler View and the number of the sub-components in each row are fixed, so that the drawing area of each sub-component can be determined, and the drawing area of each sub-component can be determined. And the initial positions of the sub-assemblies in each row of the rolling layout and the spacing of the sub-assemblies can be freely changed.