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. was improved, check out the resources tab.  Look at the
cool official chart of firmware versions!  Very few people still have
1.1 or 2.0, and fortunately 1.0 isn't even charted.

A simple majority of 54.2% have version 1.6.

27.7% have Android 1.5, I'm guessing those holdouts are HTC Sense and
Motoblur handsets like the Hero and Cliq?

I am glad to see how many people bought Droids, which is what I assume
all the 14.8% that have 2.0.1and 2.9% that have 2.0 are.  I expect
that number to climb rapidly as more Droids are bought.  I can't wait
to find out what other phone gets 2.0 first.  Has anyone considering
shipping a VGA handset?



2. Debugger does not attach

hi, just starting with android dev and there seems to be a problem
with the de{*filter*}. Whenever I try to debug my app, it starts the
emulator and displays this message- Waiting for the de{*filter*}.
Application XXX is waiting for the de{*filter*} to attach. In the Eclipse
the last message displayed is My First Android App]ActivityManager:
Starting: Intent { }

Anything I can do to be able to connect to de{*filter*}? Thanks.


3. Android News aggregator

4. Stronger PIM Suite...?

5. Why some apps apear in just-in in android market but they have reviews 2 months old?

6. How can the string bar 90 degrees clockwise rotation appear?

7. 3rd party Eclipse plugins you use for Android