Gepro
Gepro

Reputation: 583

Android - Layout at the bottom of a view and don't overlay

I have a problem to layout my view. I want the "buttonsLayout" to dock at the bottom of the view. That is no problem, but my "buttonsLayout" overlays the "pager". I want that the "pager" stops, where the "buttonsLayout" begins.

I have read so many posts, but nothing helps. What is wrong ?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<android.support.v4.view.ViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:background="@color/gray" >
</android.support.v4.view.ViewPager>

<RelativeLayout
    android:id="@+id/buttonsLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal" >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="Left" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="Right" />
</RelativeLayout>

</RelativeLayout>

Upvotes: 0

Views: 1074

Answers (1)

Leonidos
Leonidos

Reputation: 10518

Add android:layout_above = "@+id/buttonsLayout" to your pager layout. So pager will never overlay buttons.

P.S. I cant see one more closing RelativeLayout tag in your xml...

Upvotes: 4

Related Questions