如何为Android XML Layout属性使用多个值?

时间:2012-08-04 15:17:21

标签: android android-layout android-linearlayout android-xml

我觉得以前一定要问这个,但我找不到。

我想要LinearLayout,以便所有内容都与右边和底部对齐。

我试过了:

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

所有这些产生

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

我想我可以在子元素上使用边距,但我宁愿不这样做。

1 个答案:

答案 0 :(得分:20)

Grah。这是空间。正确的语法是

    android:gravity="right|bottom"

我希望Eclipse会有这样的建议,如果它看到你输入一个字符串。像

Error: String types not allowed (at 'gravity' with value 'right, bottom').
If you want to enter multiple values, use the syntax "value1|value2"
相关问题