Setting initial focus of widgets on screen

Put your problem here if it does not fit any of the other categories.

Setting initial focus of widgets on screen

Postby bluefloyd8 » Fri Mar 21, 2008 8:59 pm

I need to figure out a way to set which object has focus on the screen first. I have a layout with 4 widgets. The editText widget gets focus first even though it is the third item listed in the layout. Any idea on how to make the first item (the Spinner) have the focus first?

Thanks.

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content">
   <Spinner android:id="@+id/milespinner" ...
   <Spinner android:id="@+id/genrespinner" ...
   <EditText android:id="@+id/inputtxt"  ...
   <Button android:id="@+id/search"  ...
</LinearLayout>
User avatar
bluefloyd8
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Jan 22, 2008 3:57 am
Location: Indiana, USA

Top

Postby michael_g_hu » Sun Mar 23, 2008 3:24 pm

there is an attribute requesFocus just like the below:
<Button ....>
<requestFocus/>
</Button
michael_g_hu
Developer
Developer
 
Posts: 35
Joined: Fri Mar 21, 2008 9:46 am

Postby bluefloyd8 » Sun Mar 23, 2008 6:17 pm

Thanks for the help!
User avatar
bluefloyd8
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Jan 22, 2008 3:57 am
Location: Indiana, USA

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests