简体   繁体   English

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

[英]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. 我希望有一个LinearLayout ,使得一切都与右边和底部对齐。

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. 我想我可以在子元素上使用边距,但我宁愿不这样做。

Grah. 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. 我希望Eclipse会有这样的建议,如果它看到你输入一个字符串。 Like 喜欢

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM