Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

android - Can you set "tab order" in XML Layout?

I've got users with tablets that have a tab key on their soft keyboard. I am using a table view and have 3 EditText Fields in one row with EditText fields below the current row.

When the user hits tab it takes them to the next field below, not the next field to the right.

Is there a way in the layout to set the tab order or is it only done programatically?

If it can only be done in Java, how exactly is it done?

Thanks for the tip on NextFocusRight but it didn' seem to work (or I did something wrong)

Here is the code I used. I have to add the imeoptions to get the "next" button to show up in my emulator. Do you see anything wrong with the way I did this?

<EditText 
    android:id="@+id/bikeHHT"
    android:layout_width="50dip"
    android:layout_height="40dip"
    android:textSize="14px"
    android:maxLength="2"
    android:nextFocusLeft="@+id/bikeMMT"
    android:imeOptions="actionNext"
    android:layout_column="1"/>

<EditText 
    android:id="@+id/bikeMMT"
    android:layout_width="50dip"
    android:layout_height="40dip"
    android:textSize="14px"
    android:nextFocusRight="@+id/bikeSST"
    android:imeOptions="actionNext"
    android:maxLength="2"/>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Replace android:nextFocusLeft by android:nextFocusDown. The "next" soft button or the TAB key is looking for the next "down" focus and not left or right.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...