Skip to content Skip to sidebar Skip to footer

How Can I Remove Space Between Layout And Background?

What i have is a relative layout which contain other two relative layout and each of them have images and i have made each image as background to it's relative layout but still i c

Solution 1:

Remove the padding in your top level layout

Solution 2:

Remove all padding properties from main RelativeLayout.

Try this...

<RelativeLayoutxmlns: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"tools:context=".MainActivity" ><RelativeLayoutandroid:id="@+id/relative1"android:layout_width="match_parent"android:layout_height="150sp"android:layout_alignParentRight="true"android:layout_alignParentTop="true"android:layout_alignParentLeft="true"android:background="@drawable/upper" ></RelativeLayout><RelativeLayoutandroid:id="@+id/relative2"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:layout_alignParentLeft="true"android:layout_alignParentRight="true"android:layout_below="@+id/relative1"android:background="@drawable/down" ><ListViewandroid:id="@+id/listView1"android:layout_width="wrap_content"android:layout_height="280dp"android:layout_alignParentLeft="true"android:layout_alignParentTop="true" ></ListView></RelativeLayout></RelativeLayout>

This may help you..

Solution 3:

Your Relative Layout defined as:

<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

Here you have defined that it should always have margin on all sides with these attributes:

        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"

Simply remove them and you should be fine.

What you want:

<RelativeLayoutxmlns: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"tools:context=".MainActivity" >

Post a Comment for "How Can I Remove Space Between Layout And Background?"