 <h2>Focus Handling</h2> <p>Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer. </p> <p>Change default behaviour of directional navigation by using following XML attributes:</p> <pre><code>android:nextFocusDown="@+id/.." android:nextFocusLeft="@+id/.." android:nextFocusRight="@+id/.." android:nextFocusUp="@+id/.." </code></pre> <p>Besides directional navigation you can use tab navigation. For this you need to use</p> <pre><code>android:nextFocusForward="@+id/.." </code></pre> <p>To get a particular view to take focus, call </p> <pre><code>view.requestFocus() </code></pre> <p>To listen to certain changing focus events use a <a href="http://developer.android.com/reference/android/view/View.OnFocusChangeListener.html"><code>View.OnFocusChangeListener</code></a></p> <hr> <h2>Keyboard button</h2> <p>You can use <a href="http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions"><code>android:imeOptions</code></a> for handling that extra button on your keyboard.</p> <blockquote> <p>Additional features you can enable in an IME associated with an editor to improve the integration with your application. The constants here correspond to those defined by imeOptions. </p> </blockquote> <p>The constants of imeOptions includes a variety of actions and flags, see the link above for their values. </p> <p><strong>Value example</strong></p> <p><a href="http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_NEXT">ActionNext</a> : </p> <blockquote> <p>the action key performs a "next" operation, taking the user to the next field that will accept text.</p> </blockquote> <p><a href="http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_MASK_ACTION">ActionDone</a> :</p> <blockquote> <p>the action key performs a "done" operation, typically meaning there is nothing more to input and the IME will be closed.</p> </blockquote> <p><strong>Code example:</strong></p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" &gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="32dp" android:layout_marginTop="16dp" android:imeOptions="actionNext" android:singleLine="true" android:ems="10" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/editText1" android:layout_below="@+id/editText1" android:layout_marginTop="24dp" android:imeOptions="actionDone" android:singleLine="true" android:ems="10" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>If you want to listen to imeoptions events use a <a href="http://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html"><code>TextView.OnEditorActionListener</code></a>. </p> <pre><code>editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { performSearch(); return true; } return false; } }); </code></pre> <hr>