如何在保留活动中滚动功能的同时显示键盘?

发布于 2024-11-19 19:47:57 字数 251 浏览 3 评论 0原文

我有一个基本上是一种形式的活动。当用户选择编辑文本时,活动要么遮盖表单的一部分(包括提交按钮),要么尝试重新调整,但这不起作用,因为唯一的可滚动区域是表单本身 - 其他所有内容都与权重紧密相关。我已使用“android:windowSoftInputMode”尝试将其调整为调整大小或平移,但由于上述结果,两者都不起作用。

我正在寻找的是键盘是否显示以及活动是否隐藏 - 用户仍然可以在活动中上下滚动以在键盘显示时查看表单的其他部分。这可能吗?

提前致谢。

I have an activity which is basically a form. When the user selects an edittext, the activity either obscures part of the form (including the submit button) or tries to readjust which doesnt work because the only scrollable area is the form itself - everything else is pretty tightly bound with weights. I have used "android:windowSoftInputMode" to try and adjust it to either resize or panning but both don't work due to the outcome above.

What I am looking for is that the keyboard is shown and whether the activity is hidden or not - the user can still scroll up and down in the activity to see other parts of the form while the keyboard is showing. Is this possible?

Thanks in advance.

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

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

发布评论

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

评论(1

马蹄踏│碎落叶 2024-11-26 19:47:58

是的,这应该是可能的,我有一项活动与你似乎正在尝试的事情做同样的事情。我所拥有的只是一个带有一堆子布局和小部件的 ScrollView 。每当键盘出现时,我都没有问题。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <LinearLayout android:layout_width="match_parent" android:id="@+id/abstractWorkOrderParentLayout" android:layout_height="match_parent" android:orientation="vertical">
     ****ALL WIDGETS GO HERE****
  </LinearLayout>
</ScrollView>

我在abstractWorkOrderParentlayout中至少有20多个垂直对齐的小部件,并且滚动效果正如我认为你想要的那样

ya that should be possible, i have an activity that does the same thing as what you seem to be trying. all i have is a ScrollView with a bunch of children layouts and widgets. and any time the keyboard comes up, i dont have a problem.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <LinearLayout android:layout_width="match_parent" android:id="@+id/abstractWorkOrderParentLayout" android:layout_height="match_parent" android:orientation="vertical">
     ****ALL WIDGETS GO HERE****
  </LinearLayout>
</ScrollView>

i have at least 20 more widgets aligned vertically in abstractWorkOrderParentlayout and the scrolling works as i think you want it to

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