Question: I am looking at the Honeycomb Gallery sample code ([here](http://developer.android.com/resources/samples/HoneycombGallery/index.html)) and I ran across the following code while trying to add action items in my own app:

```
<item android:id="@+id/camera"
    android:title="Camera"
    android:icon="?attr/menuIconCamera"
    android:showAsAction="ifRoom" />

```

The `?attr` is throwing me for a loop. Can someone please explain what this is doing? How is this related to a drawable? I can't seem to find any good information on Google. Also is there a listing or gallery of attributes we can use for icons instead of just `menuIconCamera`?

Thanks

Edit:
I did some more looking around and found that attrs.xml looks like this:

```
<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>

```

Unfortunately that just makes it even more confusing for me. What is this doing?

Answer: 
The `?attr/menuIconCamera` value means that an icon from `menuIconCamera` attribute of the current theme will be used.

There must be a drawable assigned to the `menuIconCamera` attribute somewhere in the `themes.xml` file. If there're two themes with different values of this attribute then actual icon will depend on a theme which is currently used.

The `attrs.xml` file is used to define custom attributes. Without this definition compiler will treat unknown attributes as erroneous.
This blog post does an amazing job going over how to reference values for style-attributes that are defined in the current theme:
<https://trickyandroid.com/android-resources-and-style-attributes-cheatsheet/>

* When you see `?` notation - it means that we are trying to reference a style attribute - a value
which may vary depending on current theme. In each specific theme we can override this attribute, so
the XML layout doesn't need to be changed, and the correct theme needs to be applied.
* When you see the `@` notation - we reference actual resource value (color, string, dimension,
etc). This resource should have an actual value. In this case we know exactly what value we are
dealing with.

Here's an example:

```
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="LauncherButton" parent="TextAppearance.AppCompat.Medium">
        <item name="android:textColor">?colorAccent</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_centerHorizontal">true</item>
        <item name="android:textAllCaps">false</item>
    </style>

```