{"id":352,"date":"2023-02-25T07:08:10","date_gmt":"2023-02-24T23:08:10","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=352"},"modified":"2023-04-30T14:45:57","modified_gmt":"2023-04-30T06:45:57","slug":"solution-to-ejecting-control-layout-when-android-soft-keyboard-pops-up","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/solution-to-ejecting-control-layout-when-android-soft-keyboard-pops-up\/","title":{"rendered":"Android \u8f6f\u952e\u76d8\u5f39\u51fa\u65f6\u628a\u63a7\u4ef6\u5e03\u5c40\u9876\u51fa\u53bb\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>Android \u8f6f\u952e\u76d8\u5f39\u51fa\u65f6\u628a\u63a7\u4ef6\u5e03\u5c40\u9876\u51fa\u53bb\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<h3>\u5728Activity\u7684onCreate\u4e2dsetContentView\u4e4b\u524d\u52a0\u5165\u4ee3\u7801<\/h3>\n<pre><code>getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u6216\u8005\u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u5bf9\u5e94\u7684<activity>\u52a0\u5165<\/p>\n<pre><code>android:windowSoftInputMode=&quot;stateVisible|adjustResize&quot;<\/code><\/pre>\n<p>\u8fd9\u6837\u4f1a\u8ba9\u5c4f\u5e55\u6574\u4f53\u4e0a\u79fb\u3002\u5982\u679c\u52a0\u4e0a\u7684\u662f<\/p>\n<pre><code>android:windowSoftInputMode=&quot;adjustPan&quot;<\/code><\/pre>\n<p>\u952e\u76d8\u5219\u4f1a\u8986\u76d6\u5c4f\u5e55<\/p>\n<h3>\u5c06xml\u5e03\u5c40\u6587\u4ef6\u9876\u7ea7\u7684layout\u66ff\u6362\u6210ScrollView<\/h3>\n<p>\u6216\u8005\u8bf4\u5728\u9876\u7ea7\u7684layout\u4e0a\u9762\u518d\u52a0\u4e00\u5c42ScrollView\u7684\u5c01\u88c5\uff0c\u8fd9\u6837\u88ab\u9876\u51fa\u53bb\u7684\u63a7\u4ef6\u5e03\u5c40\u5c31\u4f1a\u9650\u5236\u5728ScrollView\u5185\u6eda\u52a8\u4e86\uff0c\u8f6f\u952e\u76d8\u4f1a\u4e00\u76f4\u5904\u4e8e\u5e95\u90e8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android \u8f6f\u952e\u76d8\u5f39\u51fa\u65f6\u628a\u63a7\u4ef6\u5e03\u5c40\u9876\u51fa\u53bb\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a \u5728Activity\u7684onCreate\u4e2dsetCont [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-352","post","type-post","status-publish","format-standard","hentry","category-android-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=352"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/352\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}