Default focus on RelativeLayout

by devileper » Sun, 12 Apr 2009 05:10:46 GMT

Sponsored Links
 How can you specify which item gets the default focus on Activity
startup?  Using requestFocus programmatically does not work. On
setContextView the first focusable item listed in the XML is given the
default focus. When using RelativeLayout, the first item listed is not
always the desired item or necessarily on top.

Default focus on RelativeLayout

by Mark Murphy » Sun, 12 Apr 2009 09:01:15 GMT


API samples show requestFocus() working in onCreate(), so I am not
certain where your problem lies.

For example: 

If you cannot figure out the problem, post some sample code illustrating
how you are trying requestFocus(), and perhaps we can see the problem.

Mark Murphy (a Commons Guy)  | 

Android App Developer Training: 


Sponsored Links

Default focus on RelativeLayout

by Ward Willats » Sun, 12 Apr 2009 23:00:29 GMT


I have had good luck with requestFocus() in most cases 
(RelativeLayout or otherwise) I've run into trouble where:

1. The focused item was in a ScrollView and caused the view to scroll 
unexpectedly -- confusing me!

2. The activity had a TabHost on it -- the TabHost seems to always 
steal the focus sometime after onCreate(). I've never figured out a 
way around this.

-- Ward


Other Threads

1. AnyBody to test My Application on Droid,N1.

Thank you very much for the testing, I dont know why users are complaining
so much and giving only one star with comment... if it is running fine on
Droid,G1 and probably it should be on N1.

They are experiencing a force close issue.I think it will be a ANR issue but

Thank You again,
Abdul Ma{*filter*}.


2. Debugging on handset, can i send dummy gps cords?

Hiya, Ive made my first mapview/gps based app.

Ive been mostly testing it on the emulators which are horribly laggy
so now that Ive got my droid/milestone I wanted to debug on the
handset through ADB. Theres an option in the handset's menu to allow
dummy gps co-ordinates, Id assumed you could use the DDMS tab in
eclipse and sent the co-ordinates like you would to the emulator...but
that section is greyed out and disabled.

Is it possible to send the dummy co-ordinates to a handset? Ive had a
look around and I cant seem to find out how, the official guide only
mentions sending the co-ordinates to an emulator.

Thanks for any replies.



3. how does two native shared library communicated?

4. Multiple overlay items

5. How to use OpenGL ES 1.x with android.view.View (without using GLSurfaceView) in Android 1.6?

6. Deleting a View from its Parent

7. Alternative Market: Is it Possible?