您的位置:首页 > 其它

关于ScrollView和Viewpager嵌套问题

2017-01-01 11:12 134 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/guaxianyi2941/article/details/53965288 在ScrollView中顶层是一个搜索框  搜索框下面是ViewPager  往下滑动Viewpager的时候  搜索框不跟着往上滑  求解  如何让搜索框也往上面滑动

贴上代码


<ScrollView
        android:id="@+id/pull_refresh_scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"
        android:scrollbars="none" >

        <RelativeLayout style="@style/fill_wrap" >

            <RelativeLayout
                android:id="@+id/rel_search"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/dimen_30_dip"
                android:layout_marginBottom="@dimen/dimen_10_dip"
                android:layout_marginLeft="@dimen/dimen_20_dip"
                android:layout_marginRight="@dimen/dimen_20_dip"
                android:layout_marginTop="@dimen/dimen_10_dip"
                android:background="@drawable/white_boarder"
                android:focusable="true"
                android:focusableInTouchMode="true" >

                <RelativeLayout
                    android:id="@+id/search_rl"
                    android:layout_width="@dimen/dimen_28_dip"
                    android:layout_height="@dimen/dimen_28_dip"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true" >

                    <ImageView
                        android:id="@+id/search_iv"
                        android:layout_width="@dimen/dimen_18_dip"
                        android:layout_height="@dimen/dimen_15_dip"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="@dimen/dimen_10_dip"
                        android:src="@drawable/search" />
                </RelativeLayout>

                <EditText
                    android:id="@+id/key_et"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_toLeftOf="@+id/search_rl"
                    android:background="@null"
                    android:hint="请输入关键字"
                    android:maxLength="10"
                    android:paddingLeft="@dimen/dimen_5_dip"
                    android:singleLine="true"
                    android:textColor="@color/ablack"
                    android:textCursorDrawable="@null"
                    android:textSize="@dimen/dimen_14_sp" />
            </RelativeLayout>

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/rel_search"
                android:background="@color/white" />
        </RelativeLayout>
    </ScrollView>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: