{"id":3967,"date":"2021-02-05T16:32:39","date_gmt":"2021-02-05T08:32:39","guid":{"rendered":"http:\/\/122.152.205.50\/wordpress\/?p=3967"},"modified":"2021-04-24T20:20:43","modified_gmt":"2021-04-24T12:20:43","slug":"view%e4%bd%93%e7%b3%bb%ef%bc%88%e4%b8%89%ef%bc%89%ef%bc%9aactivity%e7%9a%84%e6%9e%84%e6%88%90","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=3967","title":{"rendered":"View\u4f53\u7cfb\uff08\u4e09\uff09\uff1aActivity\u7684\u6784\u6210"},"content":{"rendered":"<p>http:\/\/liuwangshu.cn\/application\/view\/6-activity-constitute.html \uff08\u5218\u671b\u8212\uff09<\/p>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/122.152.205.50\/wordpress\/wp-content\/uploads\/2021\/02\/activity.png\"><img src=\"http:\/\/122.152.205.50\/wordpress\/wp-content\/uploads\/2021\/02\/activity.png\" alt=\"\" \/><\/a><\/p>\n<p>\u6240\u4ee5\uff0c\u4e86\u89e3\u4e86\u4e0a\u9762\u7684activity\u7684\u6784\u6210\u4e4b\u540e\uff0c\u6709\u54ea\u4e9b\u7528\u9014\u5462\uff1f<\/p>\n<h3>\u5b9e\u7528\u573a\u666f1<\/h3>\n<p>\u6700\u8fd1\u5728\u505a\u4e00\u6b3e\u8f66\u673a\u5e94\u7528\uff0c\u4f46\u662f\u7cfb\u7edf\u8981\u6c42\u5e94\u7528\u9002\u914d\u5de6\u8fb9\u7684\u4e00\u4e2a\u4fa7\u8fb9\u680f\u3002\u8fd9\u6837\u7684\u8bdd\uff0c\u90a3\u6211\u6bcf\u4e2aactivity\u90fd\u5f97\u5728\u6839\u5e03\u5c40\u5de6\u8fb9\u8bbe\u7f6e\u4e00\u4e2a\u548c\u4fa7\u8fb9\u680f\u5bbd\u5ea6\u4e00\u6837\u7684margin\u503c\u3002<\/p>\n<p>\u4e8e\u662f\uff0c\u6211\u5728BaseActivity\u91cc\u628a\u5c06\u539f\u6709\u7684contentLayout\u53d6\u5230\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2a\u548c\u4fa7\u8fb9\u6837\u4e00\u6837\u5927\u5c0f\u7684view\u4e0e\u539f\u6709\u7684contentLayout\u5f62\u6210\u4e00\u4e2a\u7ebf\u6027\u5e03\u5c40\u518d\u52a0\u5230decorView\u91cc\u89e3\u51b3\u95ee\u9898\uff1a<\/p>\n<pre><code class=\"language-java line-numbers\"> private void relayoutContent() {\n        \/\/\u5df2\u7ecf\u6267\u884c\u8fc7\u4e00\u6b21\uff0c\u4e0d\u91cd\u590d\u6267\u884c\u3002\n        if (contentParent != null) {\n            return;\n        }\n        \/\/\u8c03\u6574\u5e94\u7528\u5e03\u5c40\u7684\u7559\u767d\n        View contentView = getContentView(this);\n        \/\/ContentFrameLayout\n        contentParent = (ViewGroup) contentView.getParent();\n        LogUtil.d(TAG, \"contentParent \" + contentParent);\n        contentParent.removeAllViews();\n\n        \/\/\u521b\u5efa\u4e00\u4e2aLinearLayout\u88c5\u7559\u767d\u548ccontentView\n        LinearLayout linearLayout = new LinearLayout(this);\n        ViewGroup.LayoutParams linearLayoutLP = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);\n        linearLayout.setLayoutParams(linearLayoutLP);\n\n        linearLayout.setOrientation(LinearLayout.HORIZONTAL);\n\n        NavigationPlaceHolderView navigationPlaceHolderView = new NavigationPlaceHolderView(this);\n        LinearLayout.LayoutParams navigationPlaceHolderViewLP = new LinearLayout.LayoutParams(145, ViewGroup.LayoutParams.MATCH_PARENT);\n        navigationPlaceHolderViewLP.width = 145;\n        navigationPlaceHolderViewLP.height = ViewGroup.LayoutParams.MATCH_PARENT;\n        navigationPlaceHolderView.setLayoutParams(navigationPlaceHolderViewLP);\n        navigationPlaceHolderView.setId(VIEW_ID_NAVIGATION_PLACE_HOLDER_VIEW);\n        linearLayout.addView(navigationPlaceHolderView);\n\n        LinearLayout.LayoutParams contentLP = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT);\n        contentLP.weight = 1;\n        contentView.setLayoutParams(contentLP);\n        linearLayout.addView(contentView);\n\n        contentParent.addView(linearLayout);\n\n    }\n<\/code><\/pre>\n<button class=\"simplefavorite-button\" data-postid=\"3967\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>http:\/\/liuwangshu.cn\/application\/view\/6-activity-c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[124],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/3967"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3967"}],"version-history":[{"count":5,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/3967\/revisions"}],"predecessor-version":[{"id":4246,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/3967\/revisions\/4246"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3967"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}