tags:

views:

1521

answers:

2

The home screen of my Android application has three EditText views, meant to be used as three different search functions, each with a "Search" button.

The app works perfectly on the device (G1) when using the trackball: I can move between the EditTexts with the trackball, all the events fire as expected, I can enter text using the physical keyboard in the selected EditText, Enter correctly submits the proper search, etc. etc.

However, I can't switch between the EditText views using touches - only by using the trackball. Touches seem to be completely ignored by the EditText. Touches do fire for the buttons, but very hard - takes a lot of tries to make a touch register.

In the simulator, clicking on any EditText does nothing - the first one always remains selected, and I never get a soft keyboard.

This is all inside a TabHost - I've read there are some problems with that configuration, but it sounds like a slightly different issue (the EditText doesn't seem to lose focus - everything works perfectly with the trackball).

Any suggestions for what I can check?

A: 

It sounds like your touch targets are too small. I would suggest adding some padding to each of your EditTexts, or using a TouchDelegate to increase the size of the touch target.

Mike
Thanks for the answer!However, it doesn't seem to make much of a difference... I set the padding for one of the EditTexts to 100px, it takes up almost half the screen, but it still won't grab focus.The only time the EditText grabs focus is when one of the buttons is selected, and I touch anywhere other than on the button - but even then, only the first EditText gets focus, so it feels more like the button just loses focus and it's given to the first focusable element on the screen.Either there are some focusing rules I don't understand, or something else is capturing the touches...
alex_c
A: 

Ah, I figured it out.

I had a ListView left in my layout from when I first set up the TabHost. Since it didn't show anything on the screen, and it was at the bottom of my layout file after everything else, I didn't notice it... Just noticed it didn't belong there and erased it, and all the controls started behaving properly.

D'oh.

alex_c