我正在使用操作栏搜索小部件。在键盘按下时进行搜索后,它会暂时留下空白。屏幕背景很暗,看起来很糟糕。我尝试添加android:hardwareAccelerated="true"
清单文件但没有成功。任何建议将不胜感激。下面是截图的链接——
2 回答
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).
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" >
And then go to your AndroidManifest.xml file and add the following to the application tag :
<application
[...]
android:theme="@style/AppTheme"
[...] >
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:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"