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
Paul Assiaw
887 PointsAndroid action bar overflow icon not showing.
Ribbit action bar overflow icon not showing for Android Version 4.1.2.
Paul Assiaw
887 PointsI've got two android 4.1.2 phones and the story is the same on both.
This is the min and targetSdkVersion android:minSdkVersion="14" android:targetSdkVersion="19"
Harry James
14,780 PointsHey Paul!
Could you please provides your styles.xml file here and I'll see if anything stands out?
Paul Assiaw
887 Points<?xml version="1.0" encoding="utf-8"?> <!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<style name="Theme.Yippee" parent="@style/Theme.AppCompat.Light"> <item name="actionBarItemBackground">@drawable/selectable_background_yippee</item> <item name="popupMenuStyle">@style/PopupMenu.Yippee</item> <item name="dropDownListViewStyle">@style/DropDownListView.Yippee</item> <item name="actionBarTabStyle">@style/ActionBarTabStyle.Yippee</item> <item name="actionDropDownStyle">@style/DropDownNav.Yippee</item> <item name="actionBarStyle">@style/ActionBar.Solid.Yippee</item> <item name="actionModeBackground">@drawable/cab_background_top_yippee</item> <item name="actionModeSplitBackground">@drawable/cab_background_bottom_yippee</item> <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Yippee</item>
<item name="android:editTextStyle">@style/EditTextAppTheme</item>
<item name="android:actionOverflowButtonStyle">@style/Theme.Yippee.Overflow</item>
<item name="android:listViewStyle">@style/Theme.Yippee.LightPurpleBackground</item>
<item name="android:gridViewStyle">@style/Theme.Yippee.LightPurpleBackground.GridView</item>
</style>
<style name="Theme.Yippee.LightPurpleBackground">
<item name="android:background">@color/light_purple_background</item>
<item name="android:divider">@null</item>
</style>
<style name="Theme.Yippee.LightPurpleBackground.GridView">
<item name="android:padding">@dimen/user_grid_spacing</item>
</style>
<style name="Theme.Yippee.Overflow" parent="@android:style/Widget.ActionButton.Overflow">
<item name="android:src">@drawable/ic_menu_overflow</item>
</style>
<style name="ActionBar.Solid.Yippee" parent="@style/Widget.AppCompat.Light.ActionBar.Solid"> <item name="background">@drawable/ab_solid_yippee</item> <item name="backgroundStacked">@drawable/ab_stacked_solid_yippee</item> <item name="backgroundSplit">@drawable/ab_bottom_solid_yippee</item> <item name="progressBarStyle">@style/ProgressBar.Yippee</item> <item name="android:titleTextStyle">@style/ActionBar.Solid.Yippee.TitleTextStyle</item> </style>
<style name="ActionBar.Solid.Yippee.TitleTextStyle"
parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/text_color</item>
</style>
<style name="ActionBar.Transparent.Yippee" parent="@style/Widget.AppCompat.Light.ActionBar"> <item name="background">@drawable/ab_transparent_yippee</item> <item name="progressBarStyle">@style/ProgressBar.Yippee</item> </style>
<style name="PopupMenu.Yippee" parent="@style/Widget.AppCompat.Light.PopupMenu"> <item name="android:popupBackground">@drawable/menu_dropdown_panel_yippee</item> </style>
<style name="DropDownListView.Yippee" parent="@style/Widget.AppCompat.Light.ListView.DropDown"> <item name="android:listSelector">@drawable/selectable_background_yippee</item> </style>
<style name="ActionBarTabStyle.Yippee" parent="@style/Widget.AppCompat.Light.ActionBar.TabView"> <item name="android:background">@drawable/tab_indicator_ab_yippee</item> </style>
<style name="DropDownNav.Yippee" parent="@style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar"> <item name="android:background">@drawable/spinner_background_ab_yippee</item> <item name="android:popupBackground">@drawable/menu_dropdown_panel_yippee</item> <item name="android:dropDownSelector">@drawable/selectable_background_yippee</item> </style>
<style name="ProgressBar.Yippee" parent="@style/Widget.AppCompat.ProgressBar.Horizontal"> <item name="android:progressDrawable">@drawable/progress_horizontal_yippee</item> </style>
<style name="ActionButton.CloseMode.Yippee" parent="@style/Widget.AppCompat.Light.ActionButton.CloseMode"> <item name="android:background">@drawable/btn_cab_done_yippee</item> </style>
<!-- this style is only referenced in a Light.DarkActionBar based theme --> <style name="Theme.Yippee.Widget" parent="@style/Theme.AppCompat"> <item name="popupMenuStyle">@style/PopupMenu.Yippee</item> <item name="dropDownListViewStyle">@style/DropDownListView.Yippee</item> </style>
<!-- Base application theme. -->
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> -->
<!-- Customize your theme here. -->
<!-- </style> -->
<style name="EditTextAppTheme" parent="android:Widget.EditText"> <item name="android:background">@drawable/apptheme_edit_text_holo_light</item> <item name="android:textColor">#000000</item> </style>
<!-- <style name="ButtonAppTheme" parent="android:Widget.Button"> c <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> --> <!-- <item name="android:minHeight">48dip</item> --> <!-- <item name="android:minWidth">64dip</item> --> <!-- <item name="android:textColor">#000000</item> --> <!-- </style> -->
<!-- <style name="ImageButtonAppTheme" parent="android:Widget.ImageButton">
<item name="android:background">@drawable/apptheme_btn_default_holo_light</item>
</style>-->
<style name="AuthBackground">
<item name="android:background">@drawable/background_fill</item>
</style>
<style name="AuthBackgroundImage">
<item name="android:scaleType">fitStart</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:src">@drawable/background</item>
</style>
<style name="AuthTitle" parent="android:Widget.Holo.Light.TextView">
<item name="android:layout_marginTop">32dp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">60sp</item>
<item name="android:textStyle">bold</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:text">@string/app_name</item>
</style>
<style name="AuthTitle.AuthSubTitle">
<item name="android:textSize">13sp</item>
<item name="android:layout_below">@+id/title</item>
<item name="android:text">@string/subtitle</item>
<item name="android:layout_alignParentTop">false</item>
<item name="android:layout_marginTop">0dp</item>
</style>
<style name="AuthFieldContainer">
<item name="android:background">@android:color/white</item>
<item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginTop">@dimen/login_vertical_margin</item>
<item name="android:orientation">vertical</item>
<item name="android:paddingBottom">@dimen/login_vertical_padding</item>
<item name="android:paddingLeft">@dimen/login_horizontal_padding</item>
<item name="android:paddingRight">@dimen/login_horizontal_padding</item>
<item name="android:paddingTop">@dimen/login_vertical_padding</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_below">@+id/subtitle</item>
</style>
<style name="AuthEditText" parent="android:Widget.Holo.Light.EditText">
<item name="android:ems">10</item>
<item name="android:textColorHint">@color/light_gray</item>
<item name="android:textSize">17sp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="AuthButton" parent="android:Widget.Holo.Light.Button">
<item name="android:background">@drawable/button_custom</item>
<item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
<item name="android:textColor">@color/text_color</item>
<item name="android:textSize">13sp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="GridImage">
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">fitXY</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_alignParentTop">true</item>
</style>
</resources>
Harry James
14,780 PointsThanks!
I wasn't aware that you were doing the Self-Destructing Message App so, didn't expect so much to be in that file!
As there is so many entries, I don't know what theme you're using on your activities so, could you also provide your AndroidManifest.xml file (That's the last file! Don't worry!)
Paul Assiaw
887 Points<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tk.sapa_it_solution.user.yippee" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission
android:name="tk.sapa_it_solution.user.yippee.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="tk.sapa_it_solution.user.yippee.permission.C2D_MESSAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".tk.sapa_it_solution.user.yippee.utils.YippeeApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Yippee" >
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.SignUpActivity"
android:label="@string/title_activity_sign_up"
android:parentActivityName=".tk.sapa_it_solution.user.yippee.ui.LoginActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.EditFriendsActivity"
android:label="@string/title_activity_edit_friends"
android:parentActivityName=".tk.sapa_it_solution.user.yippee.ui.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".tk.sapa_it_solution.user.yippee.ui.MainActivity" />
</activity>
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.RecipientsActivity"
android:label="@string/title_activity_recipients"
android:parentActivityName=".tk.sapa_it_solution.user.yippee.ui.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".tk.sapa_it_solution.user.yippee.ui.MainActivity" />
</activity>
<activity
android:name=".tk.sapa_it_solution.user.yippee.ui.ViewImageActivity"
android:label="@string/title_activity_view_image"
android:parentActivityName=".tk.sapa_it_solution.user.yippee.ui.MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".tk.sapa_it_solution.user.yippee.ui.MainActivity" />
</activity>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="tk.sapa_it_solution.user.yippee.tk.sapa_it_solution.user.yippee.utils.Receiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="tk.sapa_it_solution.user.yippee" />
</intent-filter>
</receiver>
<meta-data android:name="com.parse.push.notification_icon"
android:resource="@drawable/ic_launcher"/>
</application>
</manifest>
1 Answer
Harry James
14,780 PointsHi Paul!
Sorry about my late response.
I have checked this with my code and it doesn't look like there's anything wrong here. Are you testing your app on devices that DO NOT have a physical Overflow Menu button?
Adel Fatkhutdinov
1,697 PointsHey, Harry James! Do you know how to show the overflow menu 3 dots if my device does have a physical Overflow Menu button?
Harry James
14,780 PointsHey Adel!
Sure can! Are you wanting the Overflow Menu to only show if the device doesn't have a physical button or do you want the Overflow Menu to show both with and without a physical button (The physical button will function in the same way as the Overflow Menu button will, however).
Get back to you soon :)
Adel Fatkhutdinov
1,697 PointsHarry James
Yeah, I would like to show the 3 dots in action bar independently, so that it doesn't matter whether device has a physical button for these purposes or not.
Thanks in advance, for your replies! ;)
Harry James
14,780 PointsHey Adel!
In that case, you should just be able to provide items that you want in the Overflow Menu as items in your menu.xml file, like this:
<item
android:id="@+id/action_logout"
android:title="@string/menu_logout_label">
</item>
<item
android:id="@+id/action_edit_friends"
android:title="@string/menu_edit_friends_label">
</item>
I've checked and this works on both my phone (Which I switched between on-screen buttons and physical buttons, both showed the Overflow Menu).
Hope it helps and, if you have any more questions, give me a shout ;)
Adel Fatkhutdinov
1,697 Points<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_edit_friends" android:title="@string/menu_edit_friends_label" /> <item android:id="@+id/action_logout" android:title="@string/menu_logout_label" /> <item android:id="@+id/action_camera" android:title="@string/menu_camera_label" android:icon="@drawable/ic_menu_camera" app:showAsAction="always" /> <item android:id="@+id/action_sendText" android:title="@string/menu_sendText_label" android:icon="@drawable/ic_action_chat_black" app:showAsAction="always" /> </menu>
This is my menu.xml file and unfortunately on my Lenovo A800 with a physical overflow menu button, the dots don't apperar :(
Harry James
14,780 PointsHello again Adel!
That's a shame :'(
You can always use this idea of creating your own Overflow Menu icon and displaying that:
<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/overflow_menu"
android:icon="@drawable/ic_action_overflow"
android:title="Overflow"
app:showAsAction="always">
<menu>
<item
android:id="@+id/item_1"
android:title="Item 1">
</item>
<item
android:id="@+id/item_2"
android:title="Item 2">
</item>
</menu>
</item>
</menu>
What we're doing is we're creating an Overflow item, telling it to display as an icon, giving it a title (This won't ever be shown but it is required) and we're telling it to always display its icon.
Then, we give it a menu item with items - this is the menu that shows when we tap on the button. All of the items are the choices you see after clicking the button.
You can download the overflow icon in the Action Bar Icon Pack under core-icons. The name of the file is ic_action_overflow.png.
Hope it helps and, if you have any more questions, give me a shout :)
Adel Fatkhutdinov
1,697 PointsI will write you back, as soon as I try your solution ;) Thanx again!
peter backlund
6,910 Pointspeter backlund
6,910 PointsHave you checked your code against other versions of Android?