我正在開發一個android項目,我正在使用android:nextFocusButton
,因此用戶可以按下軟鍵盤上的下一個按鈕來移動EditText,而無需點擊每個編輯文本以進行更改焦點。android:nextFocusForward會出錯EditText
線性佈局,在水平
然後在下一行,在另一個線性佈局中我要求的用戶名和姓的佈局,在不同的EditText,然後我問了公司名。以下是顯示我的意思的截圖。
我所要做的,就是在頭名編輯文本,用戶可以在下壓,則應該將焦點切換到姓編輯文本,然後他們再按下一併將其移動到公司編輯文本。
取而代之的是,第一個名字有焦點,用戶按下下一個按鈕,並且它轉到公司編輯文本而不是姓氏。
下面是我的XML佈局的片段
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText android:id="@+id/createAccount_txtFirstName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/first_name"
android:singleLine="true"
android:inputType="textCapSentences"
android:nextFocusForward="@+id/createAccount_txtLastName"/>
<EditText android:id="@+id/createAccount_txtLastName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/last_name"
android:singleLine="true"
android:inputType="textCapSentences"
android:nextFocusForward="@+id/createAccount_txtCompanyName"/>
</LinearLayout>
<EditText android:id="@+id/createAccount_txtCompanyName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/company_name"
android:singleLine="true"
android:inputType="textCapSentences"
android:nextFocusForward="@+id/createAccount_txtEmail"/>
感謝您的幫助,您可以提供。
嘗試添加android:imeOptions =「actionNext」 – 2016-09-28 14:14:31