В пользовательском интерфейсе формы моего приложения есть TextView
и EditText
для обновления информации о пользователе, и все они в отдельных линейных макетах, как показано ниже.
Моя проблема в том, что я использую android:nextFocusDown
фокусировка на следующем EditText
, но когда пользователь вкладывает на следующую кнопку на клавиатуре, EditText
фокусирует правильное поле, но не указатель.Это начало поля, а не его конец.Как я могу получить указатель на конец поля в XML без программно?
Часть XML:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/formLayout"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:text="PROFILE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/topLayout"
android:id="@+id/txtTitle"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:text="FIRST NAME: "
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:id="@+id/txtFNameLabel"
android:textColor="@android:color/darker_gray"
android:gravity="right" />
<EditText
android:layout_height="wrap_content"
android:layout_toRightOf="@id/txtFNameLabel"
android:id="@+id/txtFName"
android:layout_alignTop="@id/txtFNameLabel"
android:hint="Name"
android:singleLine="true"
android:imeOptions="actionNext"
android:selectAllOnFocus="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:text="LAST NAME"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_height="wrap_content"
android:id="@+id/txtLNameLabel"
android:textColor="@android:color/darker_gray"
android:gravity="right"/>
<EditText
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_height="wrap_content"
android:id="@+id/txtLName"
android:hint="Last Name"
android:singleLine="true"
android:imeOptions="actionNext"
android:selectAllOnFocus="true" />
</LinearLayout>