How to get rid of the layout of Android

0

I want to remove those azul margins for my line verde get layout all and not get any margin, but do not remove padding from RelativeLayout

Is ActionBar vermelho that has a margim bottom or my View verde that has a margin top ?

layout.xml

<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"
    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=".Home">

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#ACD10A"
        />
</RelativeLayout>
    
asked by anonymous 01.09.2014 / 19:18

1 answer

0

To get the effect of padding from View which gives the line effect I suggest you include your layout in LinearLayout and put RelativeLayout below View . This way:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Home">

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:background="#ACD10A" />

    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin">

        <!-- Restante do layout -->

    </RelativeLayout>
</LinearLayout>

Some considerations:

  • Using layout_height="0dp" and layout_weight="1" forces RelativeLayout to occupy all remaining space, View emulating one line will occupy 1dp and RelativeLayout remainder.
  • 01.09.2014 / 19:29