Как исправить «TextInputLaout с представлением TextInputEditText, которое я не могу реализовать, чтобы показать следующий фокус Edittext с использованием атрибутов imeOption и nextFocustDown» - PullRequest
2 голосов
/ 01 апреля 2019

Я использовал EditText imeOption, работающий хорошо. Но когда я использую TextInputLayout внутри TextInputEditText Я видел много ресурсов и реализовать его в моем коде Но я не могу получить на самом деле результат, который я хотел.

   <!--mobile number input layout -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:focusable="true"
        android:focusableInTouchMode="true">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_call_24px"/>

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/grey_text_color"
            android:layout_marginLeft="@dimen/base_padding_small">

            <android.support.design.widget.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/etMobileNo"
                android:inputType="textNoSuggestions"
                android:hint="Mobile No"
                android:singleLine="true"
                android:paddingBottom="26dp"
                android:backgroundTint="@color/grey_text_color"
                android:textSize="18sp"
                android:maxLines="1"
                android:nextFocusDown="@+id/etPassword"
                android:imeOptions="actionNext"
                android:textColor="@color/grey_text_color"
                android:textColorHint="@color/grey_text_color"/>
        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

    <!--Password input layout-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:focusable="true"
        android:focusableInTouchMode="true">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_lock_24px"/>

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:passwordToggleContentDescription=""
            app:passwordToggleDrawable="@drawable/visibility_toggle_button"
            app:passwordToggleEnabled="true"
            app:passwordToggleTint="@color/grey_text_color"
            android:layout_marginLeft="@dimen/base_padding_small"
            android:backgroundTint="@color/grey_text_color">

            <android.support.design.widget.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/etPassword"
                android:hint="Password"
                android:inputType="textPassword"
                android:paddingBottom="26dp"
                android:maxLines="1"
                android:backgroundTint="@color/grey_text_color"
                android:textSize="18sp"
                android:imeOptions="actionDone"
                android:textColor="@color/grey_text_color"
                android:textColorHint="@color/grey_text_color"/>
        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

Я помогал по этой ссылке, но не работал. Android EditText следующий фокус

без кода Java, как я могу использовать, спасибо заранее.

1 Ответ

1 голос
/ 01 апреля 2019

Попробуйте использовать

android:imeOptions="actionNext"
android:nextFocusForward="@+id/etPassword"

вместо:

 android:nextFocusDown="@+id/etPassword"
 android:imeOptions="actionNext"
...