{"id":233682,"date":"2020-12-29T15:35:36","date_gmt":"2020-12-29T07:35:36","guid":{"rendered":"http:\/\/4563.org\/?p=233682"},"modified":"2020-12-29T15:35:36","modified_gmt":"2020-12-29T07:35:36","slug":"%e8%ae%a8%e8%ae%ba%e4%b8%80%e4%b8%8b-constraintlayout-%e5%a6%82%e4%bd%95%e4%bc%98%e9%9b%85%e7%9a%84%e5%ae%9e%e7%8e%b0%e5%a4%8d%e6%9d%82%e4%b8%80%e7%82%b9%e7%9a%84%e5%b8%83%e5%b1%80","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=233682","title":{"rendered":"\u8ba8\u8bba\u4e00\u4e0b Constraintlayout \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u590d\u6742\u4e00\u70b9\u7684\u5e03\u5c40"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8ba8\u8bba\u4e00\u4e0b Constraintlayout \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u590d\u6742\u4e00\u70b9\u7684\u5e03\u5c40               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Nuttertoo1s <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6bd4\u5982\u8fd9\u79cd<br \/><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/12\/20201230_5fec2a142c43d.png\" rel=\"noreferrer\" alt=\"\u8ba8\u8bba\u4e00\u4e0b Constraintlayout \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u590d\u6742\u4e00\u70b9\u7684\u5e03\u5c40\"><br \/>\u6211\u7684\u60f3\u6cd5\u662f\u5148\u62c9\u4e00\u4e2a Constraintlayout1\uff0c\u7136\u540e\u7528\u767e\u5206\u6bd4\u8f85\u52a9\u7ebf\u5206\u597d\u533a\u57df\uff0c\u7136\u540e\u518d\u5f80\u6bcf\u4e2a\u533a\u57df\u91cc\u586b\u4e00\u4e2a Constraintlayout2\uff0c\u4e4b\u540e\u5c31\u53ef\u4ee5\u5728 Constraintlayout2 \u586b\u5165 ImageView \u548c TextView\uff0c\u4e0d\u77e5\u9053\u8fd8\u6709\u6ca1\u6709\u4ec0\u4e48\u4f18\u96c5\u7684\u65b9\u5f0f\u53ef\u4ee5\u8ba9 2 \u4e2a\u8f85\u52a9\u7ebf\u4e4b\u95f4\u7684\u5185\u5bb9\u53d8\u6210\u4e00\u4e2a\u6574\u4f53\uff0c\u5c31\u662f\u53ef\u4ee5\u8bbe\u7f6e\u70b9\u51fb\u4e8b\u4ef6\u7684\u90a3\u79cd<br \/>\u8fd9\u662f\u5927\u6982\u7684\u7ed3\u6784\u56fe<br \/><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/12\/20201230_5fec2a1713fbf.png\" rel=\"noreferrer\" alt=\"\u8ba8\u8bba\u4e00\u4e0b Constraintlayout \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u590d\u6742\u4e00\u70b9\u7684\u5e03\u5c40\"><br \/>\u5f15\u5230\u4e3b\u5e03\u5c40\u4e4b\u540e\u7684\u6837\u5b50<br \/><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/12\/20201230_5fec2a1a12f8f.png\" rel=\"noreferrer\" alt=\"\u8ba8\u8bba\u4e00\u4e0b Constraintlayout \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u590d\u6742\u4e00\u70b9\u7684\u5e03\u5c40\">  <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>12<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4643270\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ohhhh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u628a\u56fe\u7247\u548c\u6587\u5b57\u5199\u6210\u4e00\u4e2a\u81ea\u5b9a\u4e49 view \u5c31\u597d\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643271\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Nuttertoo1s <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ohhhh \u4e0a\u4e00\u7248\u5c31\u662f\u81ea\u5b9a\u4e49 view \u6765\u89e3\u51b3\u7684\uff0c\u8fd9\u6b21\u6362\u6210 Constraintlayout \u5e03\u5c40\u60f3\u770b\u770b\u8fd8\u6709\u6ca1\u6709\u5176\u4ed6\u597d\u7684\u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643272\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ohhhh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8e72\u4e00\u4e2a \u8bf4\u4e0d\u5b9a\u6709                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643273\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ohhhh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Nuttertoo1s \u770b\u4e86\u4e00\u4e0b \u5e94\u8be5\u8fd8\u662f\u9700\u8981\u81ea\u5b9a\u4e49 view \u53bb\u89e3\u51b3\u8fd9\u4e2a\u4e8b\u60c5\uff0cConstraintlayout \u4e3b\u8981\u7528\u6765\u89e3\u51b3\u5e03\u5c40\u7684\u5d4c\u5957                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643274\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mxalbert1996 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8fd9\u4e2a\u7528 LinearLayout \u5f88\u5bb9\u6613\u5b9e\u73b0\u554a\uff0c\u800c\u4e14\u6211\u4e5f\u4e0d\u662f\u5f88\u61c2\u4e3a\u4ec0\u4e48\u8981\u81ea\u5b9a\u4e49 View \u3002\u6211\u7684\u5efa\u8bae\u662f\u9664\u975e\u7528\u5176\u4ed6 Layout \u5b9e\u73b0\u4e0d\u4e86\u6216\u8005\u5d4c\u5957\u5c42\u7ea7\u592a\u591a\uff0c\u5426\u5219\u4e0d\u8981\u7528 ConstraintLayout\uff0c\u56e0\u4e3a ConstraintLayout \u867d\u7136\u529f\u80fd\u5f3a\u5927\uff0c\u4f46\u6027\u80fd\u4e5f\u6bd4\u5176\u4ed6\u7684\u5dee\u5f97\u591a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643275\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Nuttertoo1s <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mxalbert1996 \u4e3a\u4e86\u5f3a\u8feb\u81ea\u5df1\u5b66\u4e60\u65b0\u6280\u672f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643276\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Nuttertoo1s <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mxalbert1996 \u6211\u611f\u89c9\u4ee5\u540e\u56fe\u5f62\u5316\u754c\u9762\u7ed8\u5236\u5e03\u5c40\u5e94\u8be5\u662f\u4e3b\u6d41\uff0c\u73b0\u5728 4.1 \u7248\u672c\u7684\u5df2\u7ecf\u5f88\u65b9\u4fbf\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643277\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tpkxywxd <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u754c\u9762 linear layout + textview \u5c31\u80fd\u5b9e\u73b0 https:\/\/developer.android.com\/reference\/android\/widget\/TextView#attr_android:drawableLeft                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643278\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : john6lq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u662f\u4e0d\u662f\u4e0d\u77e5\u9053\u6709\u4e2a\u4e1c\u897f\u53eb drawableStart                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643279\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lonnyzhang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 Group \u5173\u8054\u4e24\u4e2a view\uff0c\u8fd0\u884c\u65f6\u62ff\u5230 referenceIds \u904d\u5386\u8bbe\u7f6e click \u4e8b\u4ef6<\/p>\n<p>https:\/\/stackoverflow.com\/questions\/46743944\/use-group-in-constraintlayout-to-listen-for-click-events-on-multiple-views                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643280\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chenjiajia9411 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u600e\u4e48\u8fd8\u6709\u4eba\u89c9\u5f97\u7ea6\u675f\u5e03\u5c40\u6027\u80fd\u5dee\u7684\uff0c\u5d4c\u5957\u548c\u8fc7\u5ea6\u7ed8\u5236\u624d\u662f\u754c\u9762\u7ed8\u5236\u7f13\u6162\u7684\u6839\u672c\u539f\u56e0\uff0c\u4e00\u4e3e\u89e3\u51b3\u8fd9\u4e24\u4e2a\u95ee\u9898\u7684\u7ea6\u675f\u5e03\u5c40\u4e3a\u4ec0\u4e48\u4f1a\u6bd4\u5343\u5c42\u997c\u7ebf\u6027\u5e03\u5c40\u6216\u8005\u76f8\u5bf9\u5e03\u5c40\u6162\u6211\u5012\u4e5f\u662f\u4e0d\u61c2\u3002<br \/>\u5982\u679c\u8bf4\u7684\u662f\u5728 RecyclerView \u91cc\u7684\u60c5\u51b5\u7684\u8bdd\uff08\u4f30\u8ba1\u53c8\u662f[\u90a3\u7bc7\u6587\u7ae0]( https:\/\/juejin.cn\/post\/6844903685655363598)\u8bef\u5bfc\u7684\uff09\uff0c\u6211\u5c31\u4e0d\u61c2\u4e86\u4e24\u5e74\u524d\u7684\u73a9\u610f\u513f\u600e\u4e48\u73b0\u5728\u8fd8\u80fd\u62ff\u51fa\u6765\u8bf4\u7684\uff08\u91cc\u9762\u751a\u81f3\u6709\u4e00\u4e2a\u4f8b\u5b50\u662f ListView \u5728 API 18 \u4e0a\u9762\u8dd1\u7684\uff0c\u6211\u4e5f\u662f\u9189\u4e86\uff09\uff0cConstraintLayout \u7a33\u5b9a\u7248\u90fd 2.0.4 \u4e86\uff0c\u5982\u679c\u4f60\u8fd8\u5728\u7528 support \u5e93\u90a3\u771f\u662f\u6253\u6270\u4e86\u3002<br \/>\u4e3b\u7684\u95ee\u9898\u7684\u8bdd\uff0c\u4e0a\u6709\u4eba\u8bf4\u7684 drawableStart \uff08\u5728\u4f4e\u7248\u672c\u4e0a\u8fd8\u8981\u8bbe\u7f6e drawableLeft \uff09\u5c31\u53ef\u4ee5\u89e3\u51b3\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4643281\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wuliaoshixia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lonnyzhang \u6b63\u89e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8ba8\u8bba\u4e00\u4e0b Constraintla&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/233682"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=233682"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/233682\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=233682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=233682"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=233682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}