我使用 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/