简体   繁体   English

为什么使用该UI(NextFocusDown)在键盘上不显示NEXT?

[英]Why does the NEXT not show on the keyboard with this UI (NextFocusDown)?

I have a few forms in this app, strangely the XML below doesn't make the keyboard show the NEXT button for each TextInputEditText. 我在这个应用程序中有几种形式,奇怪的是,下面的XML不会使键盘为每个TextInputEditText显示NEXT按钮。

I have added a screenshot at the bottom. 我在底部添加了屏幕截图。 Clicking on any of the TextInput fields, does not show the next button in the keyboard. 单击任何TextInput字段,都不会在键盘上显示下一个按钮。 It's mind-boggling ! 令人难以置信!

<?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>

在此处输入图片说明


EDIT: the address does show the NEXT button on the keyboard. 编辑:地址确实显示键盘上的NEXT按钮。 Crazy weird that the other's don't. 疯狂的怪异对方没有。

在此处输入图片说明

The android:digits parameter breaks android:nextFocusDown android:digits参数中断android:nextFocusDown

android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'`." android:digits =“ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'`。”

I've reported the bug https://issuetracker.google.com/issues/74175708 我已经报告了该错误https://issuetracker.google.com/issues/74175708

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM