Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use multiple values for Android XML Layout properties?

I feel like this must have been asked before, but I can't find it.

I want to have a LinearLayout such that everything aligns to the right as well as to the bottom.

I've tried:

    android:gravity="right | bottom"
    android:gravity="right + bottom"
    android:gravity="right & bottom"
    android:gravity="right, bottom"
    android:gravity="right bottom"

All of these produce

 Error: String types not allowed (at 'gravity' with value 'right, bottom').

I suppose I could use margins on the sub-elements, but I'd rather not.

like image 532
MalcolmOcean Avatar asked Aug 04 '12 15:08

MalcolmOcean


1 Answers

Grah. It was the spaces. Correct syntax is

    android:gravity="right|bottom"

I wish Eclipse would have suggestions like that if it sees you're entering a string. Like

Error: String types not allowed (at 'gravity' with value 'right, bottom').
If you want to enter multiple values, use the syntax "value1|value2"
like image 168
MalcolmOcean Avatar answered Nov 09 '22 05:11

MalcolmOcean