Edittext “lag” android

0 votes
asked Nov 1, 2010 by alexander

The first time i focus an edittext view i notice a lag of one or two seconds before i can write anything in the textbox.

I notice this behavior even on an app without any code more than what's nessecary to initialize the application.

What am i doing wrong?

5 Answers

0 votes
answered Nov 1, 2010 by user432209

Are you using the emulator?

This is common when you are using the emulator regardless of debug mode or not...at least from my (limited) experience so far. Try your app out on a real phone and see what happens.

0 votes
answered Nov 1, 2010 by alexander

I turned off USB debugging and uninstalled a few keyboards. Seems to work fine now. Thanks all.

0 votes
answered Nov 27, 2013 by james-perih

I've INSTANTLY fixed this issue for me; I saw in the DDMS that a lot of redraw's and recalculations were occurring while entering text, and a lot of info about RelativeLayouts were being called. So, I checked my layout; i had some Multi-Line EditText's who were direct children of a RelativeLayout. So, I wrapped those up into a Linear Layout, and specified my desired width/height at the LinearLayout, not each EditText.

Guess what? It totally fixed it!!

(below, some code... keep in mind, this is just an approximation. Don't try and copy/paste)

BEFORE:

<RelativeLayout>
    <EditText
        android:layout_width="wrap_content" />
    <EditText
        android:layout_width="wrap_content" />
</RelativeLayout>

AFTER:

<RelativeLayout>
    <LinearLayout
        android:layout_width="wrap_content" >
        <EditText
            android:layout_width="fill_parent" />
        <EditText
            android:layout_width="fill_parent" />
    </LinearLayout>
</RelativeLayout>

Wrapped my EditText's into a LinearLayout, and relinquished dynamic layout controls to the LinearLayout. It was an amazing and instant improvement.

0 votes
answered Nov 19, 2015 by jaksnon

Edit AndroidManifest:

My old code

< uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />

My new code

< uses-sdk android:minSdkVersion="8" />

I just removed the targetSdkVersion and the lag went away.

0 votes
answered Sep 15, 2017 by user3253263

In my case the symptoms were the same, a delay occurred to present the keyboard and when typing the letters were gradually appearing. The solution is because I had put a Background image in the RelativeLayout, when I did a test taking the background worked out and stopped the delay, so I entered an online site that reduces photos and then reduced from 93kb to 50kb and worked perfectly.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...