EditText上冻结/不同时输入显示的文字 [英] EditText freezes/doesn't show text whilst typing

查看:189
本文介绍了EditText上冻结/不同时输入显示的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的安卓应用程序,我有一个的EditText 这是坐在里面的LinearLayout 。这页是用在 ViewPager

In my Android application I have an EditText which is sat inside a LinearLayout. This page is used in a ViewPager.

在大多数我所测试的设备,似乎的EditText 的行为完全正常,除了在少数。

On majority of the devices I have tested on, it seems that the EditText behaves perfectly fine, except on a few.

看来,在一些设备上,当我触摸的EditText ,并开始输入,文本不显示,但建议做节目。它是文本中出现的的EditText

It appears that on a few devices, when I touch the EditText and start typing, the text doesn't show but the suggestions do show. It is only after the Keyboard is closed that the text appears within the EditText.

为什么会出现这种情况?为什么文本不显示,而I型?为什么它显示后,才关闭键盘?

code:

<RadioGroup
    android:id="@+id/searchGroup"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="10dp">

...
...

<EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textCapWords|textPostalAddress"
        android:id="@+id/searchText"
        android:hint="@string/locationHint"
        android:imeOptions="actionDone"
        android:layout_below="@+id/locationGroup"
        android:layout_margin="10dp"
        android:singleLine="true"/>

...
...
</LinearLayout>

更新的EditText 工作正常,如果它是ViewPager`之外。这是唯一的ViewPager里面,它行为不端。

Update The EditText works fine if it's outside of the ViewPager`. It's only inside the ViewPager that it misbehaves.

推荐答案

已经碰到过这样的问题,在工作中与一些设备和拉我的头发(我相信你能AP preciate)我发现,包裹在一个滚动视图中的EditText视图可以解决该问题。滚动视图的属性进行设置,以免影响您的视图的布局。

Having come across this issue at work with a number of devices and pulling my hair out (which I am sure you can appreciate) I found that wrapping the edittext view in a scrollview resolves the problem. The properties of the scrollview can be set so as not to affect the layout of your view.

赏金我的孩子。

这篇关于EditText上冻结/不同时输入显示的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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