Android键盘滑下留下空白的背后 [英] Android keyboard slides down leaving white space behind

查看:107
本文介绍了Android键盘滑下留下空白的背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的操作栏搜索插件。搜索之后,当键盘出现故障它留下一个空白了一下。屏幕背景是黑色,这使得它看起来很糟糕。我尝试添加安卓hardwareAccelerated =真正的在没有任何成功的清单文件。 任何建议将大大AP preciated。以下是截图的链接 -

I am using action bar search widget. After a search when the keyboard goes down it leaves a white space for a moment. The screen background is dark which makes it look awful. I tried adding android:hardwareAccelerated="true" in the manifest file without any success. Any suggestion will be greatly appreciated. Below is the link of the screenshot-

http://www.flickr.com/photos/54884891@N05/10310528196 /

推荐答案

在情况下,我理解你的问题的权利(在动画中的软件键盘向下滚动,并且键盘了屏幕上的空间是白色的,在活动期间不重规模,直到键盘动画结束),解决你的问题隐藏在主体布局!

In case I understood your issue right (during the animation where the software keyboard scroll down, the space on the screen that the keyboard took is white, and the activity is not re sized until the keyboard animation is over), the solution to your problem hides in the main layout !

您说,屏幕背景的应用程序是黑暗的。井的情况下,屏幕的背景是在所有的活动一样,你可以做的是建立一个共同的屏幕背景颜色/图片应用程序的主题。因此键盘的动画过程中,或在活动之间的负载,您将看到您已设置的颜色/图片(直到活动布局加载和应用,这将是默认的背景颜色/图片)。

You said that the screen background of your application is dark. Well in case the screen background is the same in all your activities, what you can do is to set a common screen background color / picture for the application theme. And hence during the keyboard animation, or during the load between activities, you will see the color / picture that you have set (it will be the default background color / picture until the activity layout is loaded and applied).

要实现这一点,添加在styles.xml文件中的以下内容:

To achieve this, add the following in the styles.xml file :

<!-- Application theme -->
<style name="AppTheme" >
    <item name="android:windowBackground"> ... </item>
    <!-- Put the color , picture that you need -->
</style>

您还可以通过指定的样式父像这样指定的主题,你的应用程序正在使用(如果有的话):

You can also specify the main theme that your application is using (if any) by specifying the style parent like this :

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" >

然后去你的Andr​​oidManifest.xml文件,并添加以下到应用程序标签:

And then go to your AndroidManifest.xml file and add the following to the application tag :

<application
    [...]
    android:theme="@style/AppTheme"
    [...] >

试试看,你会看到你的主题,而不是普通的白色背景(这主要是由所使用的主要的Andr​​oid主题,我们使用的是自定义主题修改定义)指定的颜色。

Try it and you should see the color that you have specified in the theme instead of the plain white background (which is mainly defined by the main android theme that you are using, and which we are modifying using the custom theme).

这篇关于Android键盘滑下留下空白的背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆