如何在 Android 中点击显示软键盘时保持原始布局。

huangapple go评论55阅读模式
英文:

How to keep original layout when click show softkey in android

问题

点击“编辑文本”后显示软键盘,底部布局移动了。我想在 Android 上点击显示键盘后保持原始布局。

英文:

After I click edit text to show soft key, layout banner at bottom position layout moved up.
I want to keep origin layout after click show key board in android

答案1

得分: 0

将此属性添加到您的AndroidManifest.xml文件中的Activity中:

android:windowSoftInputMode="adjustPan"

就像下面这样:

<activity
    android:name=".MainActivity"
    android:exported="true"
    android:windowSoftInputMode="adjustPan">
英文:

add this attribute to your Activity in AndoridManifest.xml

android:windowSoftInputMode=&quot;adjustPan&quot;

Just like below:

&lt;activity
    android:name=&quot;.MainActivity&quot;
    android:exported=&quot;true&quot;
    android:windowSoftInputMode=&quot;adjustPan&quot;
    &gt;

答案2

得分: 0

在你的清单文件中添加android:windowSoftInputMode=&quot;adjustPan&quot;android:windowSoftInputMode=&quot;adjustResize&quot;
你可以选择其中一个,根据你的活动布局来选择最合适的选项。
要了解更多详情,你可以参考这个答案。adjustPan或adjustResize

如果这个答案解决了你的问题或在找到解决方案方面最有帮助,请接受这个答案。

英文:

add android:windowSoftInputMode=&quot;adjustPan&quot; or android:windowsSoftInputMode=&quot;adjustResize&quot; in you manifest file.
You can choose one of them which is most preferable to your activity layout.
For more details you can refer this answer. adjustPan or adjustResize

Please accept this answer if it solved your problem or was the most helpful in finding your solution.

huangapple
  • 本文由 发表于 2023年6月13日 18:52:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76464158.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定