Refer to ID below in XML layout

vbulletin1

New Member
In my XML layout, I have among other things two \[code\]EditText\[/code\] elements and a few buttons. XML looks like this (most things removed, only relevant pieces left)\[code\]<RelativeLayout> <RelativeLayout android:id="@+id/entry_id"> <Button android:id="@+id/btn_select" layout_alignParentRight="true" /> <EditText android:id="@+id/txt_id" android:layout_toLeftOf="@id/btn_select" anddroid:nextFocusDown="@id/txt_extras" /> <Button android:id="@+id/btn_quality" android:layout_below="txt_id" /> </RelativeLayout> <EditText android:id="@+id/txt_extras" android:layout_below="@id/entry_id" /></RelativeLayout>\[/code\]This produces a layout sort of like this:\[code\]+-----------------------------------------------+|+---------------------------------------------+||| |||| +----------------------+ +-------------+ |||| | First text field | | Button | |||| +----------------------+ +-------------+ |||| |||| +----------------+ |||| | Another button | |||| +----------------+ |||| |||+---------------------------------------------+|| || +-------------------------------------------+ || | Second text field | || +-------------------------------------------+ |+-----------------------------------------------+\[/code\]Note that this is not the entire layout, there are a lot more different views in it, but I'm only concerned with these ones. The reason \[code\]RelativeLayout\[/code\]s are used is because they actually make it possible to lay out views in the way that the client wants.Now, I need to define the block with the first text and buttons before defining the second text so that I could specify that the second text is below that block. However then I get an error in the first text field because I'm referring to the second text field in the \[code\]nextFocusDown\[/code\] attribute, because the second text field is not defined yet. This becomes catch 22. Is there any way to make eclipse/lint/whatever understand that the field it's complaining about not being there is actually there, just a few lines below? That is, is it possible to make it look at the file holistically, as a whole, and not line-by-line?Alternatively, is there any other way to specify that I want the focus to go to the second text field and not to the second button when "next" is pressed on the soft keyboard?
 
Back
Top