android - 如何修复 "TextInputLaout with TextInputEditText view I can not implement to show next focus Edittext using imeOption and nextFocustDown attribute"

标签 android android-edittext android-textinputlayout android-textinputedittext

我使用 EditText imeOption 效果很好。但是当我在 TextInputEditText 中使用 TextInputLayout 时 我看到很多资源并在我的代码中实现它 但我实际上无法得到我想要的结果。

   <!--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 next focus

如果没有 java 代码,我该如何使用,在此先感谢。

最佳答案

尝试使用

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

代替:

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

关于android - 如何修复 "TextInputLaout with TextInputEditText view I can not implement to show next focus Edittext using imeOption and nextFocustDown attribute",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55449447/

相关文章:

android - 带有 com.google.android.material.textfield.TextInputLayout 的 boxStrokeColor 不起作用

ICS 和 JellyBean 之间的 Android Wifi Direct 互通性

android - 将 Espresso 与自定义 EditText 结合使用

android - 监视用户输入的 EditText 行的最有效方法是什么?

android - 使用 ExposeDdropDownMenu 样式时如何更改 TextInputLayout Material 下拉箭头可绘制

android - TextInputlayout 在设置错误时将 edittext 变为红色

android - 在 android 中更改方向后保持布局更改持久

java - 如何在 ListView 的 3 个项目上应用单击或如何在 Android 中将 3 个项目组合为单击

android - 将图像叠加到相机预览 SurfaceView

java - 需要双击 EditText 让点击监听响应