Edittext失去了对点击的关注

时间:2017-05-19 15:24:54

标签: java android

当我点击我的片段的edittext(所有这些)时,它会立即失去焦点。我意识到重点是转移到主页按钮,但我不知道如何防止这种情况。我已经在清单中尝试了android:windowSoftInputMode="adjustPan"但它不起作用。 它只发生在我的带有android 6.0的Galaxy Tab上。 这是我的布局xml。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/planning_editor_layout_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ScrollView
        android:id="@+id/planning_editor_scrollview"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <RelativeLayout
            style="@style/AppTheme.ViewLayout"
            android:layout_height="wrap_content">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:baselineAligned="false"
                    android:minHeight="@dimen/view_size_large"
                    android:orientation="horizontal"
                    android:padding="@dimen/margin_small">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_xsmall"
                        android:gravity="center_horizontal"
                        android:orientation="vertical">

                        <br.com.elleveresultados.widget.ListItemTextView
                            android:id="@+id/planning_editor_textview_service_initials"
                            style="@style/AppTheme.TextView.ListItem"
                            android:alpha="@integer/alpha_secondary"
                            android:textColor="?android:textColorPrimaryInverse" />

                        <ImageView
                            android:id="@+id/planning_editor_imageview_status"
                            android:layout_width="@dimen/spinner_icon_size"
                            android:layout_height="@dimen/spinner_icon_size"
                            android:layout_marginTop="@dimen/margin_xsmall"
                            android:contentDescription="@string/planning_list_item_imageview_status" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="2"
                        android:orientation="vertical"
                        android:paddingEnd="@dimen/margin"
                        android:paddingStart="@dimen/margin">

                        <br.com.elleveresultados.widget.Spinner
                            android:id="@+id/planning_editor_spinner_service"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:enabled="false"
                            android:gravity="start"
                            android:hint="@string/planning_editor_spinner_service"
                            android:src="@drawable/ic_edit_black_18dp"
                            android:textAppearance="@style/TextAppearance.AppTheme.Large" />

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal">

                            <br.com.elleveresultados.widget.Spinner
                                android:id="@+id/planning_editor_spinner_track"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:gravity="start"
                                android:hint="@string/planning_editor_spinner_track"
                                android:src="@drawable/ic_edit_black_18dp"
                                android:textAppearance="@style/TextAppearance.AppTheme.Body2" />

                            <br.com.elleveresultados.widget.Spinner
                                android:id="@+id/planning_editor_spinner_direction"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="@dimen/margin_small"
                                android:enabled="false"
                                android:gravity="start"
                                android:hint="@string/planning_editor_spinner_direction"
                                android:src="@drawable/ic_edit_black_18dp"
                                android:textAppearance="@style/TextAppearance.AppTheme.Body2" />

                        </LinearLayout>

                        <br.com.elleveresultados.widget.Spinner
                            android:id="@+id/planning_editor_spinner_lane"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:enabled="false"
                            android:gravity="start"
                            android:hint="@string/planning_editor_spinner_lane"
                            android:src="@drawable/ic_edit_black_18dp"
                            android:textAppearance="@style/TextAppearance.AppTheme.Body1" />

                    </LinearLayout>

                </LinearLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginBottom="@dimen/margin"
                    android:layout_marginTop="@dimen/margin"
                    android:background="@color/divider" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="@dimen/margin_small">

                    <br.com.elleveresultados.widget.DropDown
                        android:id="@+id/planning_editor_dropdown_concessionaire"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:enabled="false"
                        android:hint="@string/planning_editor_spinner_concessionaire" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_large"
                        android:orientation="horizontal">

                        <br.com.elleveresultados.widget.DropDown
                            android:id="@+id/planning_editor_dropdown_state"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:enabled="false"
                            android:hint="@string/planning_editor_spinner_state" />

                        <br.com.elleveresultados.widget.DropDown
                            android:id="@+id/planning_editor_spinner_road"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:enabled="false"
                            android:hint="@string/planning_editor_spinner_road" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_small"
                        android:orientation="horizontal">

                        <br.com.elleveresultados.widget.DropDown
                            android:id="@+id/planning_editor_dropdown_contractor"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:enabled="false"
                            android:hint="@string/planning_editor_spinner_contractor" />

                        <br.com.elleveresultados.widget.DropDown
                            android:id="@+id/planning_editor_dropdown_lot"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:enabled="false"
                            android:hint="@string/planning_editor_spinner_lot" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_large"
                        android:baselineAligned="false"
                        android:orientation="horizontal">

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_initial_km">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_initial_km"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:imeOptions="actionNext"
                                android:inputType="number"
                                android:maxLength="3"
                                android:nextFocusForward="@+id/planning_editor_edittext_initial_m" />

                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_initial_m">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_initial_m"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:imeOptions="actionNext"
                                android:inputType="number"
                                android:maxLength="4"
                                android:nextFocusForward="@+id/planning_editor_edittext_final_km" />

                        </android.support.design.widget.TextInputLayout>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_small"
                        android:baselineAligned="false"
                        android:orientation="horizontal">

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_final_km">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_final_km"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:imeOptions="actionNext"
                                android:inputType="number"
                                android:maxLength="3"
                                android:nextFocusForward="@+id/planning_editor_edittext_final_m" />

                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_final_m">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_final_m"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:imeOptions="actionNext"
                                android:inputType="number"
                                android:maxLength="4"
                                android:nextFocusForward="@+id/planning_editor_edittext_lane_width" />

                        </android.support.design.widget.TextInputLayout>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_large"
                        android:baselineAligned="false"
                        android:orientation="horizontal">

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_lane_length">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_lane_length"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:focusable="false"
                                android:focusableInTouchMode="false"
                                android:inputType="numberDecimal" />

                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_lane_width">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_lane_width"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:imeOptions="actionDone"
                                android:inputType="numberDecimal" />

                        </android.support.design.widget.TextInputLayout>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/margin_small"
                        android:baselineAligned="false"
                        android:orientation="horizontal">

                        <android.support.design.widget.TextInputLayout
                            android:id="@+id/planning_editor_layout_quantity"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_quantity">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_quantity"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:focusable="false"
                                android:focusableInTouchMode="false"
                                android:inputType="numberDecimal" />

                        </android.support.design.widget.TextInputLayout>

                        <android.support.design.widget.TextInputLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="@dimen/margin_small"
                            android:layout_weight="1"
                            android:hint="@string/planning_editor_edittext_date">

                            <br.com.elleveresultados.widget.EditText
                                android:id="@+id/planning_editor_edittext_date"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:enabled="false"
                                android:focusable="false"
                                android:focusableInTouchMode="false"
                                android:inputType="date" />

                        </android.support.design.widget.TextInputLayout>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:weightSum="1">

                        <br.com.elleveresultados.widget.EditText
                            android:id="@+id/planning_editor_edittext_justification"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/margin_large"
                            android:layout_weight="0.9"
                            android:gravity="start|top"
                            android:inputType="textMultiLine"
                            android:maxLength="255"
                            android:maxLines="4"
                            android:scrollbars="vertical"
                            tools:ignore="LabelFor" />

                        <ImageView
                            android:id="@+id/planning_editors_imageview_save_justification"
                            style="@style/AppTheme.ImageView.Clickable"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="bottom"
                            android:layout_weight="0.1"
                            android:contentDescription="@string/planning_editor_iamgeview_justification"
                            android:src="@drawable/ic_done_all_accent_24dp" />
                    </LinearLayout>

                    <fragment
                        android:id="@+id/planning_editor_fragment_attachment"
                        android:name="br.com.elleveresultados.widget.PhotoAttachment"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/view_size_large"
                        tools:layout="@layout/widget_photo_attachment" />

                </LinearLayout>

            </LinearLayout>

            <com.github.clans.fab.FloatingActionMenu
                android:id="@+id/planning_editor_fam_validation"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="@dimen/fab_size"
                fab:menu_animationDelayPerItem="50"
                fab:menu_colorNormal="@color/grey_300"
                fab:menu_colorPressed="@color/black_tertiary"
                fab:menu_fab_label="@string/planning_list_item_imageview_status"
                fab:menu_fab_size="normal"
                fab:menu_icon="@drawable/ic_remove"
                fab:menu_labels_colorRipple="#66FFFFFF"
                fab:menu_labels_cornerRadius="3dp"
                fab:menu_labels_ellipsize="none"
                fab:menu_openDirection="down"
                tools:ignore="RelativeOverlap">

                <com.github.clans.fab.FloatingActionButton
                    android:id="@+id/planning_editor_fab_confirmed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_done_primary_18dp"
                    fab:fab_colorNormal="@color/grey_300"
                    fab:fab_colorPressed="@color/black_tertiary"
                    fab:fab_size="mini" />

                <com.github.clans.fab.FloatingActionButton
                    android:id="@+id/planning_editor_fab_not_confirmed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_clear_red_18dp"
                    fab:fab_colorNormal="@color/grey_300"
                    fab:fab_colorPressed="@color/black_tertiary"
                    fab:fab_size="mini" />

            </com.github.clans.fab.FloatingActionMenu>

        </RelativeLayout>

    </ScrollView>

    <android.support.design.widget.AppBarLayout
        android:id="@+id/planning_editor_appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:theme="@style/AppTheme.AppBarOverlay">

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/appbar_elevation"
            android:background="@drawable/appbar_top_shadow" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/planning_editor_appbar_layout_view"
                android:layout_width="match_parent"
                android:layout_height="@dimen/tab_layout_size"
                android:background="@android:color/white"
                android:gravity="center"
                android:orientation="horizontal"
                android:visibility="gone">

                <TextView
                    android:id="@+id/planning_editor_textview_last_edit"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:alpha="@integer/alpha_secondary"
                    android:gravity="center"
                    android:textColor="@color/black_primary" />

                <br.com.elleveresultados.widget.Tab
                    android:id="@+id/planning_editor_tab_edit"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:alpha="@integer/alpha_secondary"
                    android:src="@drawable/ic_edit_black_24dp"
                    android:text="@string/planning_editor_tab_edit"
                    android:textColor="@color/black_primary" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/planning_editor_appbar_layout_edit"
                android:layout_width="match_parent"
                android:layout_height="@dimen/tab_layout_size"
                android:background="@android:color/white"
                android:gravity="center"
                android:orientation="horizontal"
                android:visibility="gone">

                <br.com.elleveresultados.widget.Tab
                    android:id="@+id/planning_editor_tab_cancel"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:alpha="@integer/alpha_secondary"
                    android:src="@drawable/ic_cancel_black_24dp"
                    android:text="@string/planning_editor_tab_cancel"
                    android:textColor="@color/black_primary" />

                <br.com.elleveresultados.widget.Tab
                    android:id="@+id/planning_editor_tab_save"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:alpha="@integer/alpha_secondary"
                    android:src="@drawable/ic_save_black_24dp"
                    android:text="@string/planning_editor_tab_save"
                    android:textColor="@color/black_primary" />

            </LinearLayout>

        </RelativeLayout>

    </android.support.design.widget.AppBarLayout>

</LinearLayout>

谢谢。

0 个答案:

没有答案