我想在父亲RelativeLayout上将TextView“singleName”放在ViewPager之上,是否可能?
这里是xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:id="@+id/singleScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@+id/indicatorWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/singleName"
android:layout_width="wrap_content"
android:layout_height="@dimen/slider_height" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.view.ViewPager
android:id="@+id/singleSlider"
android:layout_width="match_parent"
android:layout_height="@dimen/slider_height"/>
</RelativeLayout>
有什么建议吗?
尝试将此添加到您的ViewPager:
android:layout_below="@id/singleScroll"
这个怎么样?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/singleSlider"
android:layout_width="match_parent"
android:layout_height="@dimen/slider_height"
android:alignParentBottom="true"
/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/singleScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/singleSlider"
>
<RelativeLayout
android:id="@+id/indicatorWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/singleName"
android:layout_width="wrap_content"
android:layout_height="@dimen/slider_height" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
这应该将viewpager放在屏幕的底部,嵌套的滚动布局应该填充上面的屏幕的其余部分。