1

I'm using RelativeLayout. I understand using Graphical Layout you can't position a button too well. How can I do it in XML? I've tried changing the marginLeft, but nothing moves.

All I want to do is position my buttons!

<Button
    android:id="@+id/ListsButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/EditButton"
    android:layout_alignBottom="@+id/EditButton"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="18dp"
    android:text="Li" />
double-beep
  • 5,031
  • 17
  • 33
  • 41
user2100364
  • 87
  • 1
  • 1
  • 15
  • This all depends on where you want them and on the rest of your xml. If you want help with something like that then you need to post your full xml and tell us exactly what you are trying to do. Pictures often help also – codeMagic Jan 22 '14 at 20:01
  • Relative layout means that widgets are aligned relative or with respect to other widgets and such...as @codeMagic said, you need to include the full xml to get help – Josh Engelsma Jan 22 '14 at 20:03

2 Answers2

0

You can use marginLeft, marginRight, marginTop, and marginBottom for small adjustments. If you want to do larger adjustments you can use blank elements in combination with weights, or use a RelativeLayout in combination with alignParentBottom, alignParentTop, alignParentRight, and/or alignParentLeft

Freelancer
  • 86
  • 1
  • 9
0

If you are beginner in android programming then I would recommend using graphical layout since you won't know every attribute for positioning and styling your views. You can see @Freelancer answer to see how many attributes you have to consider while positioning any view correctly.

Using graphical layout is very easy once you get a little hang of it. You can use Relative Layout which will help you moving any view like button or textView wherever you want. Direct xml coding will require some skills that you will no doubt get in time.

Rohan Kandwal
  • 9,112
  • 8
  • 74
  • 107
  • Yeah, Graphical Layout is pretty annoying, but I'm starting to get the hang of it. I just wish the designing an interface was more intuitive like in Visual Studio. Just place things where you want them independently, none of this layout crap that complicates use. – user2100364 Jan 22 '14 at 23:53