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

Temidayo Adelakin
Temidayo Adelakin
17,505 Points

app:showAsAction doesn't work

I'm on the code challenge for sending messages where you have to add a button to the action bar. I'm on the fourth task where it ask for me to set the button to always show.

From my knowledge of Android "app:showAsAction="always" " is the correct attribute but for some reason it's not working which is insanely annoying. I've tried android:visible but that doesn'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"/>

</menu>

1 Answer

Dan Johnson
Dan Johnson
40,533 Points

You have the correct attribute but you want the android namespace.

 android:showAsAction="always"