如何在焦点对准时使 EditText 与键盘一起抬起?

发布于 2024-12-28 04:06:18 字数 281 浏览 1 评论 0原文

就像在短信应用程序中一样,我希望键盘在弹出时将对话框向上推。我当前遇到的问题是键盘实际上在我的对话框上抬起并且屏幕不滚动。

这就是我想要的:(没有足够的声誉来发布图像)

图像一(之前)

图片二(之后)

看看它的效果如何?我该如何去做呢?

Just like in texting applications, I want the keyboard to push the dialog box up when it raises. The issue I'm currently having is that the keyboard actually raises over my dialog box and the screen does not scroll.

Here's what I want: (Don't have enough reputation to post images)

Image one (Before)

Image two (After)

See how nicely it raises? How do I go about doing that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

护你周全 2025-01-04 04:06:18

使用 RelativeLayout 并使用 android:layout_alignParentBottom="true" 放置 EditText,然后在显示键盘时它应该会自动升起。

Use a RelativeLayout and place your EditText using android:layout_alignParentBottom="true" it should then raise automatically when the keyboard is shown.

归属感 2025-01-04 04:06:18

//在清单 xml 文件中尝试 windowsoftinput 模式。

android:windowSoftInputMode="adjustResize"

adjustResize 0x10 始终调整窗口的大小:窗口的内容区域
窗口缩小,为软输入区域腾出空间

参考此

//try windowsoftinput mode in your manifest xml file.

android:windowSoftInputMode="adjustResize"

adjustResize 0x10 Always resize the window: the content area of the
window is reduced to make room for the soft input area

.

ref this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文