在编辑文本时,点击向上推内容文本、编辑、内容

2023-09-04 04:44:18 作者:凉心骚年i

我到处去寻找一个解决我的问题,但找不到答案。这里的问题。

I have searched everywhere for a solution to my problem but cannot find a answer. Here's the problem.

我有一个布局,看起来像这样

I have a layout that looks like this

现在,当我在编辑文本(搜吧)点击我想下面的情况发生。

Now when I click in the edit text(search bar) i want the following to happen

软键盘基本需要,推动了整个屏幕的内容,以便搜索栏在顶部和列表视图是在它下面,这样搜索内容时显示结果。我曾尝试设置安卓windowSoftInputMode =adjustPan活动在清单中,但并没有工作。我设置了滚动视图中包含片段主要布局在主容器中,但还没有工作。我曾尝试加入了编辑文本(搜吧),以列表视图的标题,但是这也没有工作。每次键盘炒高编辑文本,但覆盖了列表视图。有没有什么办法,使这项工作?

The soft keyboard basically needs to push up the whole screens content so that the search bar is at the top and its listview is beneath it so that when the content is searched the results are displayed. I have tried setting android:windowSoftInputMode="adjustPan" to the Activity in the manifest but this did not work. I set a scroll view as the main container in the main layout that contains the fragments but that also did not work. I have tried adding the edit text(search bar) as a header to the list view but this also did not work. Every time the keyboard pushed up the edit text but covered the list view. Is there any way to make this work?

感谢您的帮助提前

推荐答案

我无法找到一个解决方案,布局可以自动改变,所以我不得不破解它。我用code,我发现这里在我的主要活动检测当键盘被打开。我只是增加了code来调用隐藏键盘打开时,我的前两个片段的方法。这是不是真的是我想做的事,但它的工作原理。

I could not find a solution for the layout to change automatically so I had to hack it. I used the code that I found here in my main activity to detect when the keyboard is opened. I just added code to call a method that hides my top two fragments when the keyboard is opened. This isn't really what I wanted to do but it works.