我在这个应用程序中有几个表单,奇怪的是下面的XML并没有让键盘显示每个TextInputEditText的NEXT按钮。
我在底部添加了一个屏幕截图。 单击任何TextInput字段,不会显示键盘中的下一个按钮。这令人难以置信!
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.my.app.activities.PersonalActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background">
<!-- toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<!-- Main Content -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:background="@drawable/shape_rect_round_corners"
android:elevation="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_below="@+id/toolbar">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadeScrollbars="false">
<!-- descendantFocusability and focusableInTouchMode prevent autofocus -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<!-- TOOLTIP -->
<android.support.v7.widget.AppCompatImageButton
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:id="@+id/tooltip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_tooltip"
android:layout_gravity="right"/>
<!-- TITLE -->
<TextView
style="@style/BeneficiaryTitleStyle"
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:text="testing"/>
<!-- FIRST NAME and LAST NAME -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="1">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5">
<android.support.design.widget.TextInputEditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'`."
android:nextFocusDown="@id/last_name"
android:hint="@string/beneficiary_name_first"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5">
<android.support.design.widget.TextInputEditText
android:id="@+id/last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'`."
android:nextFocusDown="@id/middle_name"
android:hint="@string/beneficiary_name_last"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- MIDDLE NAME -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:weightSum="1">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText
android:id="@+id/middle_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'`."
android:nextFocusDown="@id/address_street"
android:hint="@string/beneficiary_name_middle" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- ADDRESS -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/address_street"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress|textCapWords"
android:nextFocusDown="@id/address_street2"
android:hint="@string/confirm_info_address_street" />
</android.support.design.widget.TextInputLayout>
<!-- ADDRESS2 -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/address_street2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress|textCapWords"
android:nextFocusDown="@id/address_city"
android:hint="@string/confirm_info_address_street2" />
</android.support.design.widget.TextInputLayout>
<!-- CITY, STATE, ZIP -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText
android:id="@+id/address_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"
android:nextFocusDown="@id/address_state"
android:hint="@string/confirm_info_address_city"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText
android:id="@+id/address_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapCharacters"
android:nextFocusDown="@id/address_zip"
android:hint="@string/confirm_info_address_state"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText
android:id="@+id/address_zip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:nextFocusDown="@id/phone"
android:maxLength="5"
android:hint="@string/confirm_info_address_zip"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- PHONE NUMBER max length 12 to account for the dashes -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:weightSum="1">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5">
<android.support.design.widget.TextInputEditText
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:maxLength="12"
android:hint="@string/confirm_info_phone" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
修改 地址确实显示键盘上的NEXT按钮。另一个人不喜欢疯狂。
答案 0 :(得分:0)
android:digits
参数会中断android:nextFocusDown
android:digits =&#34; abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ - &#39;`。&#34;