简体   繁体   English

键盘出现时ActionBar隐藏

[英]ActionBar is hiding when keyboard appears

I'm using ActionBarSherlock. 我正在使用ActionBarSherlock。 windowSoftInputMode is adjustPan (I've tried with adjustResize and adjustNothing also). windowSoftInputModeadjustPan (我尝试过adjustResizeadjustNothing )。

I want to keep ActionBar on screen when keyboard appears but slide my layout instead (so text remains visible). 我希望在键盘出现时将ActionBar保留在屏幕上, 而是滑动我的布局(因此文本仍然可见)。

Here is how it looks right: 这是它看起来正确的方式: 在此输入图像描述

And when keyboard is appeared: 键盘出现时: 在此输入图像描述

Question is : how can I keep ActionBar visible while using adjustPan (so EditText s will always be visible)? 问题是 :如何在使用adjustPan保持ActionBar可见(因此EditText将始终可见)?

NOTE I can't use ScrollView to hold my View 注意我不能使用ScrollView来保存我的View

I find out, that there may be problems with adjustResize (for some reason it's just uses adjustPan instead) when you applying FLAG_FULLSCREEN to Window of Activity : 我发现,当您将FLAG_FULLSCREEN应用于Activity Window时, adjustResize可能存在问题(出于某种原因,它只是使用adjustPan ):

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

Without this line resizing working just fine. 没有这条线调整工作就好了。

it looks like the layout slides up to make some space for the keyborad try: 它看起来像布局滑动为keyborad尝试创建一些空间:

add this to your manifest.xml: 将其添加到manifest.xml:

<activity android:name=".YourActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation|keyboard" />

the important part is: android:configChanges="keyboardHidden|orientation|keyboard" 重要的部分是: android:configChanges =“keyboardHidden | orientation | keyboard”

android documentation manifest.xml android文档manifest.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM