Im trying to align two buttons ("Reset" and "Apply") at the bottom but it always aligns itself to the top of the screen
`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/form_bg">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:id="@+id/strp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<com.widget.AppButton
android:id="@+id/country_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dp"
android:text="Country"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
<com.widget.AppButton
android:id="@+id/domain_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dip"
android:text="Domain"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
<com.widget.AppButton
android:id="@+id/unit_filter"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dp"
android:text="Unit"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
</LinearLayout>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@drawable/white_divider" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@drawable/black_divider" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/strp"
android:layout_alignParentBottom="true">
<com.widget.AppButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reset"
android:textStyle="bold"
android:id="@+id/button"
style="@style/btn"
android:layout_weight="1"/>
<com.widget.AppButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apply"
android:textStyle="bold"
android:id="@+id/button2"
style="@style/btn"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>`
I have of-course set layout_alignParentBottom to true but still the problem persists
You should change your last LinearLayout
by
android:layout_alignBottom="@+id/strp"
android:layout_height="match_parent"
to android:layout_height="wrap_content"
So the code should be
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/form_bg">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:id="@+id/strp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<com.widget.AppButton
android:id="@+id/country_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dp"
android:text="Country"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
<com.widget.AppButton
android:id="@+id/domain_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dip"
android:text="Domain"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
<com.widget.AppButton
android:id="@+id/unit_filter"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/button_config"
android:gravity="left"
android:padding="10dp"
android:text="Unit"
android:textColor="#000"
android:textSize="32sp"
android:textStyle="italic" />
</LinearLayout>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@drawable/white_divider" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@drawable/black_divider" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<com.widget.AppButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reset"
android:textStyle="bold"
android:id="@+id/button"
style="@style/btn"
android:layout_weight="1"/>
<com.widget.AppButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apply"
android:textStyle="bold"
android:id="@+id/button2"
style="@style/btn"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>