【发布时间】:2011-11-22 05:29:00
【问题描述】:
我正在查看 Honeycomb Gallery 示例代码 (here),并在尝试在自己的应用中添加操作项时遇到了以下代码:
<item android:id="@+id/camera"
android:title="Camera"
android:icon="?attr/menuIconCamera"
android:showAsAction="ifRoom" />
?attr 让我陷入了循环。有人可以解释这是在做什么吗?这与可绘制对象有什么关系?我似乎无法在 Google 上找到任何好的信息。还有我们可以为图标使用的属性列表或库,而不仅仅是menuIconCamera?
谢谢
编辑: 我又环顾四周,发现 attrs.xml 看起来像这样:
<resources>
<declare-styleable name="AppTheme">
<attr name="listDragShadowBackground" format="reference" />
<attr name="menuIconCamera" format="reference" />
<attr name="menuIconToggle" format="reference" />
<attr name="menuIconShare" format="reference" />
</declare-styleable>
不幸的是,这让我更加困惑。这是在做什么?
【问题讨论】:
标签: android android-layout attributes android-theme