Reputation: 19582
In a RelativeLayout
if a view has android:layout_alignParentBottom="true”
then it is placed to the bottom of the parent.
If 2 views have android:layout_alignParentBottom="true”
then both are placed on the bottom, but 1 above the other.
How can I have 2 view to have the setting android:layout_alignParentBottom="true”
and one to be stacked over the other?
android:layout_above
seems to be not applicable/working for this case.
Upvotes: 0
Views: 176
Reputation: 940
They won't be placed one after another if you have set only android:layout_alignParentBottom="true”
. Please paste your layout xml so that the real issue can be found.
Upvotes: 0
Reputation: 4584
Put the views inside a LinearLayout with orientation - vertical
, and put
layout_alignParentBottom=true
To the LinearLayout;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:background="@color/black"
android:layout_height="match_parent">
<LinearLayout
android:layout_alignParentBottom="true"
android:background="@color/red"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
Upvotes: 2
Reputation: 3757
layout_above
means "above" in a Y direction, not in a Z direction, if that makes sense. If you want them to overlay, remove the layout_above
attribute and make them both layout_alignParentBottom=true
.
Upvotes: 0