Поместить элемент над элементом в родительском RelativLayout - PullRequest
0 голосов
/ 11 сентября 2018

Я хочу поместить элемент TextView "singleName" над ViewPager на родительский RelativeLayout, возможно или нет?

здесь 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>

Любое предложение?

Ответы [ 2 ]

0 голосов
/ 11 сентября 2018

Как насчет этого?

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

Это должно поместить видовой пейджер внизу экрана, а вложенный макет прокрутки должен заполнить остальную часть экрана выше.

0 голосов
/ 11 сентября 2018

попробуйте добавить это в свой ViewPager:

android:layout_below="@id/singleScroll"
...