0

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Andre D La O
  • 33
  • 1
  • 5
  • try reading the docs before asking. http://developer.android.com/guide/topics/ui/layout/relative.html – toadzky Oct 18 '12 at 22:02

4 Answers4

0

you need to use

android:layout_marginRight
android:layout_marginLeft 
android:layout_marginTop
android:layout_marginBottom 
noxius
  • 144
  • 10
0

You need to use positioning parameters such as android:layout_below. See the Relative Layout Guide for details.

Khantahr
  • 8,156
  • 4
  • 37
  • 60
0

You should click the button and go property. That's where the diffrent positioning settings are located. For example below :@+id/VIEW then set marin top : 10dip. This will set you button 10 dip below VIEW.

Olijf
  • 39
  • 7
0
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

android:layout_marginLeft="100dp"
android:layout_marginTop="30dp"
android:text="@string/edad" />
Kelly Merrell
  • 1,245
  • 1
  • 10
  • 16