Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

I am trying to an a camera icon to my action bar on android studio, but i can see any icon. I i see is the "camera" text

I am trying to an a camera icon to my action bar on android studio, but i can see any icon. I i see is the "camera" text in my overflow. below is my me.xml file which is in my menu folder, and also is below is my onCreateOptionsMenu() method

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.me, menu);
        return true;
    }
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context=".MainActivity">
    <item android:id="@+id/action_logout"
          android:title="@string/menu_logout_lable"
          android:orderInCategory="100"
          app:showAsAction="never"/>

    <item android:id="@+id/action_edit_friends"
          android:title="@string/menu_edit_friends_label"
          />
    <item
        android:id="@+id/action_camera"
        android:title="@string/menu_camera_label"
        android:icon="@drawable/ic_action_camera"
        android:showAsAction="always"

        />

</menu>

1 Answer

i found out why, in my xml file, on the item for the camera

android:id="@+id/action_camera"
android:title="@string/menu_camera_label"
android:icon="@drawable/ic_action_camera"
android:showAsAction="always"
/>

, i changed

 android:showAsAction="always"

to

 app:showAsAction="always"

the difference been changing android: to app: .