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 Build a Self-Destructing Message Android App Sending Messages Adding a Send Button

jack hamilton
jack hamilton
5,609 Points

Finally, we always want this Like button to show, so add the attribute and value that does this in the ActionBar.

I swear I must be crazy, this is the code I am using to make sure the Like button is showing.

<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Add code in here! -->
    <item android:id="@+id/action_like"
          android:icon="@drawable/icon_thumbs_up"
          android:title="@string/like_label"
          android:visible="true" />
</menu>

I also tried app:showAsAction="always"

but that didn't work either.

layout.xml
<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Add code in here! -->
    <item android:id="@+id/action_like"
          android:icon="@drawable/icon_thumbs_up"
          android:title="@string/like_label"
          app:showAsAction="always"
          android:visible="true" />
</menu>
Andre Du Plessis
Andre Du Plessis
4,874 Points

Weird had the same thing, and everywhere in the code it is referred to as app:showAsAction ... but the acceptable answer is android:showAsAction as stated below.

1 Answer

Jesse Gravenor
Jesse Gravenor
27,272 Points

Jack,

It is: android:showAsAction="always" not: app:showAsAction="always"