Hello. There are blocks. Depending on the button pressed, blocks appear to the right, left, top and bottom. You need to embed a block with an advertisement from the bottom of the screen. On the pictures there is a block with the given green color, and the advertisement is black. I tried everything but the block with the advertisement is over the data, up to the data.

enter image description here

Markup:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.myadbtest.myadbtest.MainActivity"> <LinearLayout android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="vertical" android:background="#2bff00" android:paddingBottom="10dp"> </LinearLayout> <LinearLayout android:layout_alignParentBottom="true" android:background="#000" android:layout_width="match_parent" android:layout_height="50dp"/> </RelativeLayout> 

Tell me how to properly position the block with advertising from the bottom of the screen and the rest are already above it?

    1 answer 1

    At the top of the LinearLayout remove the alignParentBottom and paddingBottom . Place the lower LinearLayout at the very top of the markup.

     <RelativeLayout ...> < вот сюда нижний /> <а под ним второй /> </RelativeLayout> 

    Give the black a LinearLayout id - for example, banner . Add green

     android:layout_above="@id/banner"