androidpositionandroid-relativelayoutandroid-scroll

Position of objects in relativelayout


I'm a beginner in Android. I use Eclipse to program my app. When I create an .xml class and I want to set the specific position of a button, I use this code for example:

<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:background="@drawable/fm"
    android:baselineAligned="false"
    android:gravity="end" >

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:scrollX="100dp"
    android:scrollY="30dp"
    android:text="@string/edad" />

</RelativeLayout>

... but nothing happens. It sets the button in a corner. How can I get it to appear elsewhere?


Solution

  • you need to use

    android:layout_marginRight
    android:layout_marginLeft 
    android:layout_marginTop
    android:layout_marginBottom