如何阅读位运算符OR的结果(|)? [英] How to read result of bitwise operator OR (|)?

查看:242
本文介绍了如何阅读位运算符OR的结果(|)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想里面的Andr​​oid XML文件的位运算符的确认。例如,这行

I would like the confirmation on bitwise operators inside Android XML files. For example this line

android:layout_gravity="center_horizontal|bottom"

我应该怎么看呢?是从Java或Android继承规则不按位运算符自身的跨pretation?

How should I read it? Are the rules inherited from Java or Android does its own interpretation of bitwise operators?

是否支持所有的位运算符?如果是的话,你能告诉我其他运营商的例子(链接是罚款以及)?

Are all bitwise operators supported? If yes, could you show me the example of other operators (link is fine as well)?

感谢

推荐答案

android_layout_gravity 的值由Android code解析。作为记录<一个href=\"http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html#attr_android%3alayout_gravity\"相对=nofollow>此处,这里唯一认可的运营商是 | 。我不相信,国米preting | 为位或运算符是规范的一部分。 (例如, CENTER_HORIZONTAL 为0x05和右键为0x01;其位或将只是0×05)

The value of android_layout_gravity is parsed by Android code. As documented here, the only recognized operator here is |. I don't believe that interpreting | as bitwise OR operator is part of the spec. (For instance, center_horizontal is 0x05 and right is 0x01; their bitwise OR would just be 0x05.)

这篇关于如何阅读位运算符OR的结果(|)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆