{"id":191842,"date":"2013-08-29T12:23:03","date_gmt":"2013-08-29T08:23:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=191842"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=191842","title":{"rendered":"<span class=\"post_title\">Custom layouts. Part 2. CellLayout<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0418 \u0441\u043d\u043e\u0432\u0430 \u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043a\u043e\u043b\u043b\u0435\u0433\u0438.<\/p>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u044f \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b \u043a \u0432\u0430\u043c \u0441 \u0442\u043e\u043f\u0438\u043a\u043e\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u0443\u044e \u201c\u044f\u0447\u0435\u0439\u0447\u0430\u0442\u0443\u044e\u201d \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443. <br \/>  \u0421\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0441\u0442: \u0432\u0441\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043c\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0435\u0442\u043a\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u043c\u043e\u0437\u0430\u0438\u043a\u0443 \u0438\u0437 \u043a\u043d\u043e\u043f\u043e\u043a \u0438\u043b\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u043d\u0435 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u044f \u043a \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c layout\u2019\u0430\u043c. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 layout, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0448\u0443\u0441\u0442\u0440\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/bb8\/e05\/bb1\/bb8e05bb1b407bf9e95cad2dceb72a1d.png\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432<\/h5>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u0448\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u2014 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c.<br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:  <\/p>\n<ol>\n<li>left \u2014 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u044f\u0447\u0435\u0439\u043a\u0430<\/li>\n<li>top \u2014 \u043b\u0435\u0432\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430<\/li>\n<li>cellsWidth \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0447\u0435\u0435\u043a \u043f\u043e-\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438<\/li>\n<li>cellsHeight \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0447\u0435\u0435\u043a \u043f\u043e-\u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438<\/li>\n<\/ol>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u044d\u0442\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 xml:<\/p>\n<pre><code class=\"xml\">&lt;resources&gt;     &lt;declare-styleable name=&quot;CellLayout&quot;&gt;         &lt;attr name=&quot;columns&quot; format=&quot;integer&quot; \/&gt;         &lt;attr name=&quot;spacing&quot; format=&quot;dimension&quot; \/&gt;         &lt;attr name=&quot;layout_left&quot; format=&quot;integer&quot; \/&gt;         &lt;attr name=&quot;layout_top&quot; format=&quot;integer&quot; \/&gt;         &lt;attr name=&quot;layout_cellsWidth&quot; format=&quot;integer&quot; \/&gt;         &lt;attr name=&quot;layout_cellsHeight&quot; format=&quot;integer&quot; \/&gt;     &lt;\/declare-styleable&gt; &lt;\/resources&gt; <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430\u0448\u0435\u0433\u043e layout\u2019a \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a (<b>columns<\/b>) \u0438 \u043e\u0442\u0441\u0442\u0443\u043f \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u0447\u0435\u0439\u043a\u0438 (<b>spacing<\/b>).<\/p>\n<h4>LayoutParams<\/h4>\n<p>  \u041d\u0443 \u0447\u0442\u043e, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 ViewGroup, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e CellLayout.<br \/>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0441\u0432\u043e\u0439 LayoutParams, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<br \/>  LayoutParams \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043c\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RelativeLayout \u0432\u0432\u043e\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e layout_* \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c, \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a layout_toLeftOf). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 ViewGroup.LayoutParams (layout_width, layout_height). \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043c \u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 MarginLayoutParams, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u0442\u0443\u043f\u044b (margins).<\/p>\n<pre><code class=\"java\">public static class LayoutParams extends ViewGroup.LayoutParams {  \tint top = 0; \tint left = 0; \tint width = 1; \tint height = 1;  \tpublic LayoutParams(Context context, AttributeSet attrs) { \t    super(context, attrs); \t    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout); \t    left = a.getInt(R.styleable.CellLayout_layout_left, 0); \t    top = a.getInt(R.styleable.CellLayout_layout_top, 0); \t    height = a.getInt(R.styleable.CellLayout_layout_cellsHeight, -1); \t    width = a.getInt(R.styleable.CellLayout_layout_cellsWidth, -1);  \t    a.recycle(); \t}  \tpublic LayoutParams(ViewGroup.LayoutParams params) { \t    super(params);  \t    if (params instanceof LayoutParams) { \t\tLayoutParams cellLayoutParams = (LayoutParams) params; \t\tleft = cellLayoutParams.left; \t\ttop = cellLayoutParams.top; \t\theight = cellLayoutParams.height; \t\twidth = cellLayoutParams.width; \t    } \t}  \tpublic LayoutParams() { \t    this(MATCH_PARENT, MATCH_PARENT); \t}  \tpublic LayoutParams(int width, int height) { \t    super(width, height); \t}  } <\/code><\/pre>\n<p>  \u041d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0442\u0443\u0442 \u043d\u0435\u0442. \u041f\u043e\u0434\u043a\u043b\u0430\u0441c ViewGroup.LayoutParams, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439 \u043d\u0430\u0448\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0439 \u0438\u0445 \u0438\u0437 XML.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0441\u0435\u043c \u0441\u0432\u043e\u0438\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 ViewGroup:<\/p>\n<pre><code class=\"java\">public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) { \treturn new CellLayout.LayoutParams(getContext(), attrs); }  protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { \treturn p instanceof CellLayout.LayoutParams; }  protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { \treturn new CellLayout.LayoutParams(p); }  protected ViewGroup.LayoutParams generateDefaultLayoutParams() { \treturn new LayoutParams(); } <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u0434\u0443\u043c\u0430\u044e, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0441\u0430\u043c\u0438 \u0437\u0430 \u0441\u0435\u0431\u044f.<\/p>\n<h4>\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0442\u043e\u0434 onMeasure.<br \/>  \u041f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c, \u044f \u043e\u0431\u044f\u0437\u0430\u043d \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043c\u0435\u0442\u043e\u0434\u0435 onMeasure \u0438 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u041a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434, \u0433\u0434\u0435 \u043c\u044b \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<br \/>  \u0418\u0445 \u0443 \u043d\u0435\u0433\u043e \u0434\u0432\u0435:  <\/p>\n<ol>\n<li>\u041c\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0432 \u043d\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 setMeasuredDimension(width, height);, \u0433\u0434\u0435 width \u0438 height \u2014 \u043d\u0430\u0448\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u044b<\/li>\n<li>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/li>\n<\/ol>\n<p>  \u041d\u0430 \u0432\u0445\u043e\u0434 \u0432 onMeasure \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043d\u0435 \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430, \u0430 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b, \u0431\u0443\u0434\u044c \u043e\u043d \u043d\u0435\u043b\u0430\u0434\u043d\u044b. \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0442\u0443\u0442 \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u201c\u0440\u0435\u0436\u0438\u043c\u201d. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043e\u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 layout_width \u0438 layout_height \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0420\u0435\u0436\u0438\u043c \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0440\u0435\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u043a\u043e\u043c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0418\u0445 \u0442\u0440\u0438:  <\/p>\n<ul>\n<li>EXACTLY \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u0442\u043e \u043b\u0438\u0431\u043e \u0447\u0435\u0442\u043a\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, layout_width=\u201d100dp\u201d), \u0438\u043b\u0438 match_parent, \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u0435\u0434\u043a\u0430.<\/li>\n<li>AT_MOST \u2014 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0435\u0433\u043e layout_width=\u201dwrap_content\u201d, \u0430 \u043f\u0440\u0435\u0434\u043e\u043a \u0438\u043c\u0435\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0448\u0438\u0440\u0438\u043d\u0443, \u0431\u0443\u0434\u0435\u0442 AT_MOST &lt;\u0448\u0438\u0440\u0438\u043d\u0430 \u043f\u0440\u0435\u0434\u043a\u0430&gt;<\/li>\n<li>UNSPECIFIED \u2014 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 ScrollView, \u0438, \u0432, \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u043a\u0430\u043c \u0440\u0430\u0441\u0442\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e.<\/li>\n<\/ul>\n<p>  \u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f:  <\/p>\n<ul>\n<li>\u041f\u043e-\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u043a \u0437\u0430\u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043a\u0430\u043a AT_MOST \u0438\u043b\u0438 EXACTLY \u2014 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u043a\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u043a \u0437\u0430\u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 UNSPECIFIED. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443, \u043d\u0435 \u0437\u043d\u0430\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u044f\u0447\u0435\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0443 \u043d\u0430\u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u0435\u0434\u043a\u043e\u043c \u0448\u0438\u0440\u0438\u043d\u0430 \/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0447\u0435\u0435\u043a \u0432 \u0441\u0442\u0440\u043e\u043a\u0435. \u0422\u0430\u043a \u0447\u0442\u043e, \u044f \u0440\u0435\u0448\u0438\u043b, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u0435\u0434\u043a\u043e\u043c \u0448\u0438\u0440\u0438\u043d\u044b, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 48dp \u043a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0440 \u044f\u0447\u0435\u0439\u043a\u0438 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 \u043d\u043f \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e.<\/li>\n<li>\u041f\u043e-\u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0436\u0435, \u043f\u043e-\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 ScrollView \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c UNSPECIFIED, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043f\u043e \u043e\u0441\u0438 Y \u043f\u043e\u0442\u043e\u043c\u043a\u0430 \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043a\u0430\u043a \u0435\u0433\u043e \u043d\u0438\u0436\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443. \u0418\u043d\u0430\u0447\u0435, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0442\u0438 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u043a. \u0422. \u043a., \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u043a\u0440\u043e\u043b\u043b\u0430, \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0435 UNSPECIFIED \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430.<\/li>\n<\/ul>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044f \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">onLayout<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { \tint widthMode = MeasureSpec.getMode(widthMeasureSpec); \tint heightMode = MeasureSpec.getMode(heightMeasureSpec);  \tint width = 0; \tint height = 0;  \tif (widthMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.EXACTLY) { \t    width = MeasureSpec.getSize(widthMeasureSpec); \t    cellSize = (float) (getMeasuredWidth() - getPaddingLeft() - getPaddingRight()) \/ (float) columns; \t} else { \t    cellSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_CELL_SIZE, getResources() \t\t    .getDisplayMetrics()); \t    width = (int) (columns * cellSize); \t}  \tint childCount = getChildCount(); \tView child;  \tint maxRow = 0;  \tfor (int i = 0; i &lt; childCount; i++) { \t    child = getChildAt(i);  \t    LayoutParams layoutParams = (LayoutParams) child.getLayoutParams();  \t    int top = layoutParams.top; \t    int w = layoutParams.width; \t    int h = layoutParams.height;  \t    int bottom = top + h;  \t    int childWidthSpec = MeasureSpec.makeMeasureSpec((int) (w * cellSize) - spacing * 2, \t\t    LayoutParams.MATCH_PARENT); \t    int childHeightSpec = MeasureSpec.makeMeasureSpec((int) (h * cellSize) - spacing * 2, \t\t    LayoutParams.MATCH_PARENT); \t    child.measure(childWidthSpec, childHeightSpec);  \t    if (bottom &gt; maxRow) { \t\tmaxRow = bottom; \t    } \t}  \tint measuredHeight = Math.round(maxRow * cellSize) + getPaddingTop() + getPaddingBottom(); \tif (heightMode == MeasureSpec.EXACTLY) { \t    height = MeasureSpec.getSize(heightMeasureSpec); \t} else if (heightMode == MeasureSpec.EXACTLY) { \t    int atMostHeight = MeasureSpec.getSize(heightMeasureSpec); \t    height = Math.min(atMostHeight, measuredHeight); \t} else { \t    height = measuredHeight; \t}  \tsetMeasuredDimension(width, height); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0433\u043e\u0442\u043e\u0432\u043e, \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u0432\u044b\u0441\u043e\u0442\u0443 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0432 \u043d\u0435\u0433\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c. \u041d\u043e \u0433\u0434\u0435 \u0436\u0435 \u043f\u043e\u0442\u043e\u043c\u043a\u0438? \u0418\u0445 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435: \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430.  <\/p>\n<h4>\u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2014 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430. \u041e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 onLayout. \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 \u2014 \u043c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0434\u0435\u0442\u0438\u0448\u0435\u043a \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435.<\/p>\n<pre><code class=\"java\">protected void onLayout(boolean changed, int l, int t, int r, int b) { \tint childCount = getChildCount();  \tView child; \tfor (int i = 0; i &lt; childCount; i++) { \t    child = getChildAt(i);  \t    LayoutParams layoutParams = (LayoutParams) child.getLayoutParams();  \t    int top = (int) (layoutParams.top * cellSize) + getPaddingTop() + spacing; \t    int left = (int) (layoutParams.left * cellSize) + getPaddingLeft() + spacing; \t    int right = (int) ((layoutParams.left + layoutParams.width) * cellSize) + getPaddingLeft() - spacing; \t    int bottom = (int) ((layoutParams.top + layoutParams.height) * cellSize) + getPaddingTop() - spacing;  \t    child.layout(left, top, right, bottom); \t} } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u0441\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<p>  \u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e, \u0432\u043e\u0442 \u0438 \u0432\u0441\u0451. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u0439 layout, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0435\u0442\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0439 layout<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;ScrollView xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;     xmlns:cl=&quot;http:\/\/schemas.android.com\/apk\/res\/com.evilduck.celllayout&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;wrap_content&quot;     tools:ignore=&quot;HardcodedText&quot; &gt;      &lt;com.evilduck.celllayout.CellLayout         android:id=&quot;@+id\/cell_layout&quot;         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         cl:columns=&quot;4&quot;         cl:spacing=&quot;1dp&quot;         tools:context=&quot;.MainActivity&quot; &gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;0&quot;             cl:layout_top=&quot;0&quot;             android:background=&quot;#00FF00&quot;             android:text=&quot;View 1&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;3&quot;             cl:layout_left=&quot;1&quot;             cl:layout_top=&quot;0&quot;             android:background=&quot;#FFFF00&quot;             android:text=&quot;View 2&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;1&quot;             cl:layout_top=&quot;1&quot;             android:background=&quot;#FFFFFF&quot;             android:text=&quot;View 3&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;0&quot;             cl:layout_top=&quot;1&quot;             android:background=&quot;#00FFF0&quot;             android:text=&quot;View 4&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;2&quot;             cl:layout_left=&quot;2&quot;             cl:layout_top=&quot;1&quot;             android:background=&quot;#00FA00&quot;             android:text=&quot;View 5&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;2&quot;             cl:layout_cellsWidth=&quot;3&quot;             cl:layout_left=&quot;0&quot;             cl:layout_top=&quot;2&quot;             android:background=&quot;#AAFFAA&quot;             android:text=&quot;View 5&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;2&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;3&quot;             cl:layout_top=&quot;2&quot;             android:background=&quot;#45CCdd&quot;             android:text=&quot;View 6&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;3&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;0&quot;             cl:layout_top=&quot;4&quot;             android:background=&quot;#FF00FF&quot;             android:text=&quot;View 7&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;3&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;1&quot;             cl:layout_top=&quot;4&quot;             android:background=&quot;#FFFF00&quot;             android:text=&quot;View 8&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;3&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;2&quot;             cl:layout_top=&quot;4&quot;             android:background=&quot;#00FF00&quot;             android:text=&quot;View 9&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;3&quot;             cl:layout_top=&quot;4&quot;             android:background=&quot;#FFFF00&quot;             android:text=&quot;View 10&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;3&quot;             cl:layout_top=&quot;5&quot;             android:background=&quot;#FFFFFF&quot;             android:text=&quot;View 11&quot; \/&gt;          &lt;TextView             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             cl:layout_cellsHeight=&quot;1&quot;             cl:layout_cellsWidth=&quot;1&quot;             cl:layout_left=&quot;3&quot;             cl:layout_top=&quot;6&quot;             android:background=&quot;#555555&quot;             android:text=&quot;View 12&quot; \/&gt;     &lt;\/com.evilduck.celllayout.CellLayout&gt; &lt;\/ScrollView&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/d11\/f0e\/6e1\/d11f0e6e13219a30df4a1a09d5109009.png\"\/><\/p>\n<p>  \u0423\u0440\u0430, \u0432\u0440\u043e\u0434\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e layout\u2019a \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0443\u0436 \u0438 \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043d\u0438 \u0432 \u043a\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0432\u0430\u0441 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b, \u043d\u043e, \u0438\u043d\u043e\u0433\u0434\u0430, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u0438 \u043b\u0443\u0447\u0448\u0435 \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0447\u0435\u043c \u043d\u0435 \u0437\u043d\u0430\u0442\u044c, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<br \/>  \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u043c\u043e\u0435\u043c <a href=\"https:\/\/github.com\/TheHiddenDuck\/cell-layout\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>.<\/p>\n<p>  \u042f \u0442\u0430\u043c \u0442\u0430\u043a\u0436\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0435.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/191842\/\"> http:\/\/habrahabr.ru\/post\/191842\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0418 \u0441\u043d\u043e\u0432\u0430 \u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043a\u043e\u043b\u043b\u0435\u0433\u0438.<\/p>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u044f \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b \u043a \u0432\u0430\u043c \u0441 \u0442\u043e\u043f\u0438\u043a\u043e\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u0443\u044e \u201c\u044f\u0447\u0435\u0439\u0447\u0430\u0442\u0443\u044e\u201d \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443. <br \/>  \u0421\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0441\u0442: \u0432\u0441\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043c\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0435\u0442\u043a\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u043c\u043e\u0437\u0430\u0438\u043a\u0443 \u0438\u0437 \u043a\u043d\u043e\u043f\u043e\u043a \u0438\u043b\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u043d\u0435 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u044f \u043a \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c layout\u2019\u0430\u043c. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 layout, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0448\u0443\u0441\u0442\u0440\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/bb8\/e05\/bb1\/bb8e05bb1b407bf9e95cad2dceb72a1d.png\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-191842","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/191842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191842"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/191842\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}