NestedScrollView不能顺利滚动多个EditText在android中

时间:2015-08-19 10:49:31

标签: android android-design-library nestedscrollview

我的布局中有多个NestedScrollViewEditText

Spinners。 NestedScrollView不能顺利滚动。使用EditText拦截触摸事件。我如何解决这个问题请帮助

MyLayout.xml

<?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"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true" >

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp" >

        <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />

        <ImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax"
            android:contentDescription="@null"
            android:fitsSystemWindows="true"
            android:minHeight="100dip"
            android:scaleType="centerCrop" />

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            android:background="@drawable/trans_bg_black"
            android:contentDescription="@null" >
        </ImageView>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/action_set_background"
            android:layout_gravity="bottom"
            android:background="@drawable/scrim_bottom" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:id="@+id/nestedScroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    android:layout_marginBottom="?attr/actionBarSize"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:background="@color/white"
    android:fillViewport="true"
    android:scrollbars="none" >

    <!-- <FrameLayout -->
    <!-- android:id="@+id/frame_containeredit" -->
    <!-- android:layout_width="match_parent" -->
    <!-- android:layout_height="match_parent" -->
    <!-- android:background="@color/white" > -->
    <!-- </FrameLayout> -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical"
        android:padding="@dimen/splash_sub_header_text_size" >

        <HorizontalScrollView
            android:id="@+id/horizontalScrollView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/linearMoreImages"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="@dimen/simple_edit_text_padding" >
            </LinearLayout>
        </HorizontalScrollView>

        <View
            style="@style/HorizontalLineWhite"
            android:layout_marginTop="8dip" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dip"
            android:baselineAligned="true"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtRoomName"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:text="@string/room_name"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtRoomName"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:padding="8dip"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtSqureFeetCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/square_feet"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtSqureFeet"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:inputType="number"
                android:padding="8dip"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtRoomTypeCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/room_type"
                android:textColor="@color/black" />

            <Spinner
                android:id="@+id/spnRoomType"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:background="@drawable/rect_white_filled"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/txtNotesCaption"
                style="@style/SimpleTextViewMediumStyleFillParent"
                android:layout_marginTop="10dip"
                android:text="@string/notes"
                android:textColor="@color/black" />

            <EditText
                android:id="@+id/edtNotes"
                style="@style/SimpleEditTextStyle"
                android:layout_marginTop="3dip"
                android:gravity="top|left"
                android:lines="2"
                android:padding="8dip"
                android:textColor="@color/black" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:baselineAligned="true"
            android:orientation="horizontal"
            android:visibility="gone" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtTotalItemsCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/total_items"
                    android:textColor="@color/black" />

                <EditText
                    android:id="@+id/edtTotalItems"
                    style="@style/SimpleEditTextStyle"
                    android:background="@android:color/transparent"
                    android:enabled="false"
                    android:textColor="@color/black" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtTotalItemsValueCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/total_items_value"
                    android:textColor="@color/black" />

                <EditText
                    android:id="@+id/edtTotalItemsValue"
                    style="@style/SimpleEditTextStyle"
                    android:background="@android:color/transparent"
                    android:enabled="false"
                    android:textColor="@color/black" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:baselineAligned="true"
            android:orientation="horizontal"
            android:visibility="gone" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtRoomAddedonCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/room_added_on"
                    android:textColor="@color/black" />

                <TextView
                    android:id="@+id/txtRoomAddedon"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:textColor="@color/black" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dip"
                android:layout_weight="1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txtLastModifiedonCaption"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:paddingBottom="8dip"
                    android:text="@string/last_modified_on"
                    android:textColor="@color/black" />

                <TextView
                    android:id="@+id/txtLastModifiedon"
                    style="@style/SimpleTextViewMediumStyleFillParent"
                    android:textColor="@color/black" />
            </LinearLayout>
        </LinearLayout>

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

            <TextView
                android:id="@+id/txtSave"
                style="@style/SimpleTextViewStyle"
                android:layout_margin="10dip"
                android:background="@drawable/round_corner_purple_border_white"
                android:gravity="center"
                android:minWidth="150dip"
                android:padding="8dip"
                android:text="@string/save"
                android:textColor="@color/white" />
        </LinearLayout>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>

0 个答案:

没有答案