Skip to content

Instantly share code, notes, and snippets.

@ericksprengel
Created September 30, 2016 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericksprengel/a506ab89229e2f494cf9ebdef6582720 to your computer and use it in GitHub Desktop.
Save ericksprengel/a506ab89229e2f494cf9ebdef6582720 to your computer and use it in GitHub Desktop.
AndroidA02ApB - Padding vs Margin
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:orientation="vertical"
android:background="#fcc"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:background="#ccf"
android:src="@drawable/sample"
android:padding="20dp"
android:layout_margin="30dp"
android:layout_width="500px"
android:layout_height="500px" />
<TextView
android:background="#cfc"
android:text="Estou embaixo de vc."
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/imageView"
android:layout_alignParentEnd="true"
android:layout_marginEnd="36dp" />
<TextView
android:background="#cfc"
android:text="Estou ao seu lado esquerdo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/imageView" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment