{"id":109446,"date":"2026-09-24T04:57:00","date_gmt":"2026-09-23T20:57:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/109446.html"},"modified":"2026-09-24T04:57:00","modified_gmt":"2026-09-23T20:57:00","slug":"android-measurespec-%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/109446.html","title":{"rendered":"Android MeasureSpec \u8be6\u89e3"},"content":{"rendered":"<p>MeasureSpec \u662f\u7236\u5bb9\u5668\u5411\u5b50 View \u4f20\u9012\u5c3a\u5bf8\u7ea6\u675f\u7684\u552f\u4e00\u8f7d\u4f53\uff1a\u4e00\u4e2a 32 \u4f4d int\uff0c\u9ad8 2 \u4f4d\u662f\u6d4b\u91cf\u6a21\u5f0f\uff0c\u4f4e 30 \u4f4d\u662f\u6d4b\u91cf\u5c3a\u5bf8\u3002<\/p>\n<hr>\n<h3>1. \u4e3a\u4ec0\u4e48\u9700\u8981 MeasureSpec<\/h3>\n<p>Android \u7684 View \u662f\\&#8221;\u7236\u7ba1\u5b50\\&#8221;\u7684\u6811\u5f62\u7ed3\u6784\uff1a\u5b50 View \u77e5\u9053\u81ea\u5df1\u5185\u5bb9\u9700\u8981\u591a\u5927\uff0c\u7236\u5bb9\u5668\u77e5\u9053\u8fd9\u5757\u5730\u76d8\u8fd8\u5269\u591a\u5927\u3002\u4e24\u8005\u4fe1\u606f\u4e0d\u5bf9\u79f0\uff0c\u5c31\u9700\u8981\u4e00\u4efd\u534f\u5546\u534f\u8bae\u2014\u2014\u53ea\u4f20\u4e00\u4e2a int size \u65e0\u6cd5\u533a\u5206\\&#8221;\u786c\u6027\u8981\u6c42\\&#8221;\u548c\\&#8221;\u4e0a\u9650\\&#8221;\uff0c\u6240\u4ee5\u6709\u4e86 MeasureSpec\uff1a\u5c3a\u5bf8 + \u610f\u56fe\u3002<\/p>\n<p>\u6574\u6761\u94fe\u8def\u5206\u56db\u6b65\uff1a<\/p>\n<p>\u2460 \u7236\u5bb9\u5668\uff08\u6bd4\u5982 LinearLayout\uff09<br \/>\n   \u2502  \u7528\u81ea\u5df1\u7684 MeasureSpec + \u5b50\u7684 LayoutParams\uff0c\u7b97\u51fa\u5b50\u8be5\u9075\u5b88\u7684 spec<br \/>\n   \u25bc<br \/>\n\u2461 \u5b50 View.measure(childWidthSpec, childHeightSpec)<br \/>\n   \u2502  measure() \u5185\u90e8\u56de\u8c03 onMeasure()\uff0c\u5b50\u5728\u8fd9\u91cc\u7b97\u51fa\u300c\u6211\u8981\u591a\u5bbd\u591a\u9ad8\u300d<br \/>\n   \u25bc<br \/>\n\u2462 \u5b50 setMeasuredDimension(w, h)<br \/>\n   \u2502  \u628a\u7b97\u51fa\u7684\u7ed3\u679c\u5206\u522b\u5199\u8fdb mMeasuredWidth \u548c mMeasuredHeight \u4e24\u4e2a\u5b57\u6bb5<br \/>\n   \u25bc<br \/>\n\u2463 \u7236\u5bb9\u5668\u8bfb\u56de\u8fd9\u4e24\u4e2a\u503c\uff0c\u5728 onLayout() \u91cc\u6446\u653e\u5b50\u7684\u4f4d\u7f6e\uff08\u6d4b\u91cf\u9636\u6bb5\u81f3\u6b64\u7ed3\u675f\uff09<\/p>\n<p>\u4e00\u53e5\u8bdd\u6982\u62ec\uff1a\u7236\u51fa\u89c4\u5219 \u2192 \u5b50\u505a\u8ba1\u7b97 \u2192 \u7236\u6536\u7ed3\u679c\u3002\u89c4\u5219\u6765\u81ea\u300c\u7236\u7684 MeasureSpec + \u5b50\u7684 LayoutParams\u300d\uff0c\u8ba1\u7b97\u53d1\u751f\u5728 onMeasure()\uff0c\u7ed3\u679c\u88ab\u7236\u5bb9\u5668\u7528\u5728 onLayout() \u91cc\u3002<\/p>\n<hr>\n<h3>2. \u4e8c\u8fdb\u5236\u7ed3\u6784\uff1a\u4e00\u4e2a int \u88c5\u4e24\u6837\u4e1c\u897f<\/h3>\n<p>MeasureSpec \u672c\u8d28\u4e0a\u662f\u5bf9\u4e00\u4e2a int \u7684\u5c01\u88c5\uff08Java \u91cc\u662f View \u7684\u9759\u6001\u5185\u90e8\u7c7b\uff0cKotlin \u91cc\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e00\u4e2a value class\uff09\u3002<\/p>\n<p> 31 30 | 29 &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. 0<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 Mode \u2502              Size                     \u2502<br \/>\n\u2502 2 bit\u2502              30 bit                   \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n   \u2191 \u9ad8 2 \u4f4d\u5b58\u6a21\u5f0f            \u2191 \u4f4e 30 \u4f4d\u5b58\u5c3a\u5bf8<\/p>\n<p>\u6838\u5fc3\u5e38\u91cf\uff1a<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MeasureSpec<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">MODE_SHIFT<\/span> <span class=\"token operator\">=<\/span> <span class=\"token number\">30<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">MODE_MASK<\/span>  <span class=\"token operator\">=<\/span> <span class=\"token number\">0x3<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token constant\">MODE_SHIFT<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ 0xC0000000<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">UNSPECIFIED<\/span> <span class=\"token operator\">=<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token constant\">MODE_SHIFT<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ 0x00000000<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">EXACTLY<\/span>     <span class=\"token operator\">=<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token constant\">MODE_SHIFT<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ 0x40000000<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">AT_MOST<\/span>     <span class=\"token operator\">=<\/span> <span class=\"token number\">2<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token constant\">MODE_SHIFT<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ 0x80000000<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6253\u5305\u4e0e\u89e3\u5305\uff1a<\/p>\n<p><span class=\"token comment\">\/\/ \u6253\u5305\uff1a\u628a size \u622a\u65ad\u5230 30 \u4f4d\uff0c\u548c mode \u6309\u4f4d\u6216<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> size<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> mode<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token comment\">\/\/ \u4fdd\u8bc1 size \u4e0d\u4f1a\u6c61\u67d3\u9ad8 2 \u4f4d\u7684 mode<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>size <span class=\"token operator\">&amp;<\/span> <span class=\"token operator\">~<\/span><span class=\"token constant\">MODE_MASK<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">|<\/span> <span class=\"token punctuation\">(<\/span>mode <span class=\"token operator\">&amp;<\/span> <span class=\"token constant\">MODE_MASK<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u89e3\u5305<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token function\">getMode<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>measureSpec <span class=\"token operator\">&amp;<\/span> <span class=\"token constant\">MODE_MASK<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token function\">getSize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span>measureSpec <span class=\"token operator\">&amp;<\/span> <span class=\"token operator\">~<\/span><span class=\"token constant\">MODE_MASK<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5373 0x3FFFFFFF\uff0c\u6700\u5927\u7ea6 1G<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u624b\u52a8\u6784\u9020 spec \u7684\u5e38\u89c1\u5199\u6cd5\uff1a<\/p>\n<p><span class=\"token keyword\">int<\/span> spec <span class=\"token operator\">=<\/span> <span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">300<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">EXACTLY<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nview<span class=\"token punctuation\">.<\/span><span class=\"token function\">measure<\/span><span class=\"token punctuation\">(<\/span>spec<span class=\"token punctuation\">,<\/span> spec<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<hr>\n<h3>3. \u4e09\u79cd\u6d4b\u91cf\u6a21\u5f0f<\/h3>\n<table>\n<tr>\n   \u6a21\u5f0f<br \/>\n   \u5e38\u91cf<br \/>\n   \u7236\u5bb9\u5668\u7684\u542b\u4e49<br \/>\n   \u5b50 View \u5e94\u8be5\u600e\u4e48\u505a<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>EXACTLY<\/td>\n<td>1 &lt;&lt; 30<\/td>\n<td>\u4f60\u7684\u5c3a\u5bf8\u5df2\u7ecf\u5b9a\u4e86\uff0c\u5c31\u662f size<\/td>\n<td>\u76f4\u63a5\u4f7f\u7528 specSize\uff0c\u4e0d\u8981\u518d\u4e89\u8fa9<\/td>\n<\/tr>\n<tr>\n<td>AT_MOST<\/td>\n<td>2 &lt;&lt; 30<\/td>\n<td>\u4f60\u6700\u5927\u4e0d\u80fd\u8d85\u8fc7 size<\/td>\n<td>\u53d6\u300c\u5185\u5bb9\u9700\u8981\u7684\u5927\u5c0f\u300d\u4e0e specSize \u7684\u8f83\u5c0f\u503c<\/td>\n<\/tr>\n<tr>\n<td>UNSPECIFIED<\/td>\n<td>0<\/td>\n<td>\u6211\u4e0d\u7ba1\u4f60\uff0c\u4f60\u81ea\u5df1\u968f\u610f<\/td>\n<td>\u5b8c\u5168\u6309\u5185\u5bb9\u9700\u8981\u8fd4\u56de\uff08\u53ef\u6eda\u52a8\u5bb9\u5668\u5e38\u7528\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u5e94\u5230 XML \u5c5e\u6027\uff0c\u76f4\u89c9\u4e0a\uff1a<\/p>\n<table>\n<tr>\n   LayoutParams<br \/>\n   \u7236\u4e3a EXACTLY<br \/>\n   \u7236\u4e3a AT_MOST<br \/>\n   \u7236\u4e3a UNSPECIFIED<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>match_parent<\/td>\n<td>EXACTLY(\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<td>AT_MOST(\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<td>UNSPECIFIED(0 \u6216\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<\/tr>\n<tr>\n<td>wrap_content<\/td>\n<td>AT_MOST(\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<td>AT_MOST(\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<td>UNSPECIFIED(0 \u6216\u7236\u53ef\u7528\u7a7a\u95f4)<\/td>\n<\/tr>\n<tr>\n<td>100dp<\/td>\n<td>EXACTLY(100dp)<\/td>\n<td>EXACTLY(100dp)<\/td>\n<td>EXACTLY(100dp)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u4ee5\u770b\u51fa\uff1a\u5177\u4f53\u6570\u503c\u6c38\u8fdc\u53d8\u6210 EXACTLY\uff0c\u8fd9\u662f\u6700\u7a33\u5b9a\u7684\u4e00\u6761\u89c4\u5219\u3002<\/p>\n<p>\u5178\u578b\u7684 UNSPECIFIED \u573a\u666f\uff1a<\/p>\n<ul>\n<li>ScrollView \u6d4b\u91cf\u552f\u4e00\u5b50 View \u7684\u9ad8\u5ea6\uff08\u53ea\u80fd\u6eda\u4e00\u5c4f\uff0c\u6240\u4ee5\u9ad8\u5ea6\u4e0d\u8bbe\u4e0a\u9650\uff09\u3002<\/li>\n<li>ListView \/ RecyclerView \u6d4b\u91cf item \u7684\u9ad8\u5ea6\u3002<\/li>\n<li>\u624b\u52a8\u8c03\u7528 view.measure(0, 0) \u6216 makeMeasureSpec(0, UNSPECIFIED) \u505a\u9884\u6d4b\u91cf\u3002<\/li>\n<li>PopupWindow \u5728 WRAP_CONTENT \u4e0b\u6d4b\u91cf\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<hr>\n<h3>4. \u6838\u5fc3 API \u901f\u67e5<\/h3>\n<p><span class=\"token comment\">\/\/ &#8212;- \u6253\u5305 \/ \u89e3\u5305 &#8212;-<\/span><br \/>\n<span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> size<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> mode<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\">\/\/ \u6784\u9020\u4e00\u4e2a measuicSpec<\/span><br \/>\n<span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMode<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span>            <span class=\"token comment\">\/\/ \u53d6\u6a21\u5f0f<\/span><br \/>\n<span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getSize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span>            <span class=\"token comment\">\/\/ \u53d6\u5c3a\u5bf8<\/span><br \/>\n<span class=\"token class-name\">View<span class=\"token punctuation\">.<\/span>MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span>           <span class=\"token comment\">\/\/ \u8c03\u8bd5\u6253\u5370\uff0c\u5982 \\&#8221;EXACTLY 1080\\&#8221;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ &#8212;- \u7236\u5bb9\u5668\u7528\u5b83\u7ed9\u5b50 View \u751f\u6210 spec &#8212;-<\/span><br \/>\n<span class=\"token class-name\">ViewGroup<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getChildMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> spec<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> padding<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> childDimension<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ &#8212;- \u5b50 View \u7528\u5b83\u88c1\u526a\u81ea\u5df1\u7684\u6d4b\u91cf\u7ed3\u679c &#8212;-<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getDefaultSize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> size<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">resolveSize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> size<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">)<\/span>                    <span class=\"token comment\">\/\/ \u8fd4\u56de\u7eaf\u5c3a\u5bf8<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">resolveSizeAndState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> size<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> ms<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> childMeasuredState<span class=\"token punctuation\">)<\/span> <span class=\"token comment\">\/\/ \u5e26\u72b6\u6001\u4f4d<\/span><\/p>\n<p><span class=\"token comment\">\/\/ &#8212;- \u5b50 View \u4e0a\u62a5\u7ed3\u679c &#8212;-<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">setMeasuredDimension<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> measuredWidth<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> measuredHeight<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMeasuredWidth<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">\/<\/span> <span class=\"token function\">getMeasuredHeight<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token class-name\">View<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMeasuredState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr>\n<h3>5. MeasureSpec \u4ece\u54ea\u6765\uff1a\u6d4b\u91cf\u89c4\u5219\u7684\u5411\u4e0b\u4f20\u9012<\/h3>\n<h4>5.1 \u6811\u9876\uff1aDecorView \/ ViewRootImpl<\/h4>\n<p>\u6d4b\u91cf\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u3002ViewRootImpl.performMeasure() \u4f1a\u62ff\u5230\u7a97\u53e3\u53ef\u7528\u5c3a\u5bf8\uff0c\u7136\u540e\u8c03\u7528\uff1a<\/p>\n<p><span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token function\">getRootMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> windowSize<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> measurement<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">int<\/span> measureSpec<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">switch<\/span> <span class=\"token punctuation\">(<\/span>measurement<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token class-name\">ViewGroup<span class=\"token punctuation\">.<\/span>LayoutParams<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">MATCH_PARENT<\/span><span class=\"token operator\">:<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u6491\u6ee1\u7a97\u53e3 \u2192 \u786c\u6027\u8981\u6c42<\/span><br \/>\n            measureSpec <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span>windowSize<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">EXACTLY<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token class-name\">ViewGroup<span class=\"token punctuation\">.<\/span>LayoutParams<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">WRAP_CONTENT<\/span><span class=\"token operator\">:<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u6700\u591a\u6491\u6ee1\u7a97\u53e3 \u2192 \u4e0a\u9650<\/span><br \/>\n            measureSpec <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span>windowSize<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">AT_MOST<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">default<\/span><span class=\"token operator\">:<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5177\u4f53\u6570\u503c \u2192 \u786c\u6027\u8981\u6c42<\/span><br \/>\n            measureSpec <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">makeMeasureSpec<\/span><span class=\"token punctuation\">(<\/span>measurement<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">EXACTLY<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> measureSpec<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u5c31\u662f\\&#8221;\u6839 MeasureSpec \u7684\u751f\u6210\u89c4\u5219\\&#8221;\uff0c\u4e5f\u662f\u6574\u4e2a\u6620\u5c04\u8868\u7684\u7b2c\u4e00\u884c\u539f\u578b\uff1aMATCH_PARENT \u2192 EXACTLY\u3001WRAP_CONTENT \u2192 AT_MOST\u3001\u56fa\u5b9a\u503c \u2192 EXACTLY\u3002<\/p>\n<h4>5.2 \u4e2d\u95f4\u5c42\uff1aViewGroup.getChildMeasureSpec<\/h4>\n<p>\u6bcf\u4e00\u4e2a ViewGroup \u5728\u6d4b\u91cf\u81ea\u5df1\u7684\u5b69\u5b50\u65f6\uff0c\u90fd\u8981\u628a\u300c\u81ea\u5df1\u7684 spec\u300d\u548c\u300c\u5b69\u5b50\u7684 LayoutParams\u300d\u5408\u6210\u300c\u5b69\u5b50\u7684 spec\u300d\u3002\u8fd9\u6bb5\u903b\u8f91\u88ab\u62bd\u53d6\u6210\u4e86\u516c\u5171\u9759\u6001\u65b9\u6cd5\uff1a<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token function\">getChildMeasureSpec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> spec<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> padding<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> childDimension<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">int<\/span> specMode <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMode<\/span><span class=\"token punctuation\">(<\/span>spec<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> specSize <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getSize<\/span><span class=\"token punctuation\">(<\/span>spec<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u53ef\u7528\u7a7a\u95f4 = \u7236\u7ed9\u7684\u5c3a\u5bf8 &#8211; \u5df2\u5360\u7528\u7684 padding \/ margin<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> size <span class=\"token operator\">=<\/span> <span class=\"token class-name\">Math<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">max<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> specSize <span class=\"token operator\">&#8211;<\/span> padding<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">int<\/span> resultSize <span class=\"token operator\">=<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> resultMode <span class=\"token operator\">=<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">switch<\/span> <span class=\"token punctuation\">(<\/span>specMode<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n        <span class=\"token comment\">\/\/ \u7236\u5bb9\u5668\u81ea\u5df1\u88ab\u5f3a\u5236\u56fa\u5b9a\u5927\u5c0f<\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">EXACTLY<\/span><span class=\"token operator\">:<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>childDimension <span class=\"token operator\">&gt;=<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n                <span class=\"token comment\">\/\/ \u5b50 View \u8981\u5177\u4f53\u6570\u503c\uff0c\u6ee1\u8db3\u5b83<\/span><br \/>\n                resultSize <span class=\"token operator\">=<\/span> childDimension<span class=\"token punctuation\">;<\/span><br \/>\n                resultMode <span class=\"token operator\">=<\/span> <span class=\"token class-name\">MeasureSpec<\/span><span class=\"token punctuation\">.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MeasureSpec \u662f\u7236\u5bb9\u5668\u5411\u5b50 View \u4f20\u9012\u5c3a\u5bf8\u7ea6\u675f\u7684\u552f\u4e00\u8f7d\u4f53\uff1a\u4e00\u4e2a 32 \u4f4d int\uff0c\u9ad8 2 \u4f4d\u662f\u6d4b\u91cf\u6a21\u5f0f\uff0c\u4f4e 30 \u4f4d\u662f\u6d4b\u91cf\u5c3a\u5bf8\u3002 1. \u4e3a\u4ec0\u4e48\u9700\u8981 MeasureSpec<br \/>\nAndroid \u7684 View \u662f\\&#8221;\u7236\u7ba1\u5b50\\&#8221;\u7684\u6811\u5f62\u7ed3\u6784\uff1a\u5b50 View \u77e5\u9053\u81ea\u5df1\u5185\u5bb9\u9700\u8981\u591a\u5927\uff0c\u7236\u5bb9\u5668\u77e5\u9053\u8fd9\u5757\u5730\u76d8\u8fd8\u5269\u591a\u5927\u3002\u4e24\u8005\u4fe1\u606f\u4e0d\u5bf9\u79f0\uff0c\u5c31\u9700\u8981\u4e00\u4efd\u534f\u5546\u534f\u8bae\u2014\u2014\u53ea\u4f20\u4e00\u4e2a int size \u65e0\u6cd5\u533a\u5206\\&#8221;\u786c\u6027\u8981\u6c42\\&#8221;\u548c\\&#8221;\u4e0a\u9650\\&#8221;\uff0c\u6240\u4ee5\u6709\u4e86 MeasureSpec\uff1a\u5c3a\u5bf8 + \u610f\u56fe\u3002<br \/>\n\u6574\u6761\u94fe\u8def\u5206\u56db\u6b65\uff1a<br \/>\n\u2460<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[84,1220,2801,99,1693],"topic":[],"class_list":["post-109446","post","type-post","status-publish","format-standard","hentry","category-server","tag-android","tag-android-studio","tag-gradle","tag-java","tag-kotlin"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/109446.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"MeasureSpec \u662f\u7236\u5bb9\u5668\u5411\u5b50 View \u4f20\u9012\u5c3a\u5bf8\u7ea6\u675f\u7684\u552f\u4e00\u8f7d\u4f53\uff1a\u4e00\u4e2a 32 \u4f4d int\uff0c\u9ad8 2 \u4f4d\u662f\u6d4b\u91cf\u6a21\u5f0f\uff0c\u4f4e 30 \u4f4d\u662f\u6d4b\u91cf\u5c3a\u5bf8\u3002 1. \u4e3a\u4ec0\u4e48\u9700\u8981 MeasureSpec Android \u7684 View \u662f&quot;\u7236\u7ba1\u5b50&quot;\u7684\u6811\u5f62\u7ed3\u6784\uff1a\u5b50 View \u77e5\u9053\u81ea\u5df1\u5185\u5bb9\u9700\u8981\u591a\u5927\uff0c\u7236\u5bb9\u5668\u77e5\u9053\u8fd9\u5757\u5730\u76d8\u8fd8\u5269\u591a\u5927\u3002\u4e24\u8005\u4fe1\u606f\u4e0d\u5bf9\u79f0\uff0c\u5c31\u9700\u8981\u4e00\u4efd\u534f\u5546\u534f\u8bae\u2014\u2014\u53ea\u4f20\u4e00\u4e2a int size \u65e0\u6cd5\u533a\u5206&quot;\u786c\u6027\u8981\u6c42&quot;\u548c&quot;\u4e0a\u9650&quot;\uff0c\u6240\u4ee5\u6709\u4e86 MeasureSpec\uff1a\u5c3a\u5bf8 + \u610f\u56fe\u3002 \u6574\u6761\u94fe\u8def\u5206\u56db\u6b65\uff1a \u2460\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/109446.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-23T20:57:00+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/109446.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/109446.html\",\"name\":\"Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-23T20:57:00+00:00\",\"dateModified\":\"2026-09-23T20:57:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/109446.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/109446.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/109446.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android MeasureSpec \u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/109446.html","og_locale":"zh_CN","og_type":"article","og_title":"Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"MeasureSpec \u662f\u7236\u5bb9\u5668\u5411\u5b50 View \u4f20\u9012\u5c3a\u5bf8\u7ea6\u675f\u7684\u552f\u4e00\u8f7d\u4f53\uff1a\u4e00\u4e2a 32 \u4f4d int\uff0c\u9ad8 2 \u4f4d\u662f\u6d4b\u91cf\u6a21\u5f0f\uff0c\u4f4e 30 \u4f4d\u662f\u6d4b\u91cf\u5c3a\u5bf8\u3002 1. \u4e3a\u4ec0\u4e48\u9700\u8981 MeasureSpec Android \u7684 View \u662f\"\u7236\u7ba1\u5b50\"\u7684\u6811\u5f62\u7ed3\u6784\uff1a\u5b50 View \u77e5\u9053\u81ea\u5df1\u5185\u5bb9\u9700\u8981\u591a\u5927\uff0c\u7236\u5bb9\u5668\u77e5\u9053\u8fd9\u5757\u5730\u76d8\u8fd8\u5269\u591a\u5927\u3002\u4e24\u8005\u4fe1\u606f\u4e0d\u5bf9\u79f0\uff0c\u5c31\u9700\u8981\u4e00\u4efd\u534f\u5546\u534f\u8bae\u2014\u2014\u53ea\u4f20\u4e00\u4e2a int size \u65e0\u6cd5\u533a\u5206\"\u786c\u6027\u8981\u6c42\"\u548c\"\u4e0a\u9650\"\uff0c\u6240\u4ee5\u6709\u4e86 MeasureSpec\uff1a\u5c3a\u5bf8 + \u610f\u56fe\u3002 \u6574\u6761\u94fe\u8def\u5206\u56db\u6b65\uff1a \u2460","og_url":"https:\/\/www.wsisp.com\/helps\/109446.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-23T20:57:00+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/109446.html","url":"https:\/\/www.wsisp.com\/helps\/109446.html","name":"Android MeasureSpec \u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-23T20:57:00+00:00","dateModified":"2026-09-23T20:57:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/109446.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/109446.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/109446.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Android MeasureSpec \u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/109446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=109446"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/109446\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=109446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=109446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=109446"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=109446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}