d的的EditText是隐藏的虚拟键盘显示时和一个Surface

d的的EditText是隐藏的虚拟键盘显示时和一个Surface

本文介绍了Android的的EditText是隐藏的虚拟键盘显示时和一个SurfaceView涉及的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的用户界面:一个EditText应位于下方的SurfaceView。我用一个RelativeLayout的安排这两种观点。

I have a simple user interface: an EditText should be located below a SurfaceView.I use a RelativeLayout to arrange these two views.

现在,当我轻点的EditText的SurfaceView向上滑动,但EditText上是隐藏的,不显示输入的字符串,来打开虚拟键盘

Now, when I tap on the EditText to open the virtual keyboard the SurfaceView slides up but the EditText is hidden and does not show the typed string.

要复制,使用下面的布局XML code:

To reproduce, use the following layout XML code:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_height="fill_parent"
android:layout_width="fill_parent">

<SurfaceView
android:id="@+id/SurfaceView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</SurfaceView>

<EditText
android:id="@+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:selectAllOnFocus="true"
android:textStyle="normal"
android:singleLine="true">
</EditText>

</RelativeLayout>

主要活动类只需要显示的布局。当我启动该程序,然后点击EditText上,出现了虚拟键盘,但该领域的EditText走了。

The main Activity class only needs to show the layout. When I start the program and tap the EditText, the virtual keyboard appears but the EditText field is gone.

也许RelativeLayout的原因造成的问题,但我不知道如何重现相同的布局与其他布局类。

Maybe the RelativeLayout is causing the problems, but I don't know how to reproduce the same layout with another Layout class.

任何建议,欢迎,我真的AP preciate你的帮助。

Any suggestions are welcome, I really appreciate your help.

感谢。

编辑:

下面是两个截屏,一个显示的EditText上在底部没有虚拟键盘,一个虚拟键盘,但没有的EditText。有趣的是注意到,SurfaceView和实际的EditText向上移动,所述的EditText刚好消失。顺便说一句,这也恰好一个按钮,如果它旁边的EditText。

Here are two screenshots, one showing the EditText at the bottom without virtual keyboard, one with virtual keyboard but with no EditText. It is interesting to note that the SurfaceView and the EditText actually shift upward, the EditText just disappears. BTW this also happens to a button if it is next to the EditText.

的EditText低于SurfaceView(左); EditText上消失(右)

推荐答案

作为一个评论者中的的建议,这很容易通过设置 SurfaceView GLSurfaceView的背景颜色来解决这个问题透明与 mSurfaceView.setBackgroundColor(Color.TRANSPARENT); 以及

As a commenter in the thread about this bug suggested, it is very easy to fix this problem by setting the background color of the SurfaceView or GLSurfaceView to transparent with mSurfaceView.setBackgroundColor(Color.TRANSPARENT); as well.

在$ P $上三星Galaxy Tab 10.1 pssing的的EditText 对蜂窝(V13)发生对我来说这个问题。问题是, GLSurfaceView 被调整后,在其位置仍然是一个黑色的矩形将其覆盖的EditText 。该解决方案的工作原理是使这一错误的长方形透明,因此的EditText 可以看出。

This problem occurred for me when pressing an EditText on Honeycomb (v13) on a Samsung Galaxy Tab 10.1. The issue was that after the GLSurfaceView was resized, in its place was still a black rectangle which was covering the EditText. This solution works by making that erroneous rectangle transparent, so the EditText can be seen.

这篇关于Android的的EditText是隐藏的虚拟键盘显示时和一个SurfaceView涉及的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:41