Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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"