android


items don't appear directly in the action bar as action buttons


I have followed the tutorail http://developer.android.com/guide/topics/ui/actionbar.html for creating an action bar with items apear directly in the action bar as action buttons. yet my items don't appear as buttons.. this is how it looks like: (the items: delete, edit,add)
any idea why?
my device is galaxy s4
this is my code:
activity:
public class SingleTask extends ActionBarActivity{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_task);
final android.support.v7.app.ActionBar actionbar = getSupportActionBar();
actionbar.show();
//some more things .....
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.task_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
task_menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/action_delete"
android:icon="#drawable/ic_action_remove"
android:orderInCategory="101"
android:title="#string/action_delete"
android:showAsAction="ifRoom"/>
<item android:id="#+id/action_edit"
android:icon="#drawable/ic_action_edit"
android:title="#string/action_edit"
android:orderInCategory="102"
android:showAsAction="ifRoom"/>
<item android:id="#+id/create_new"
android:icon="#drawable/ic_action_new"
android:title="#string/action_add"
android:orderInCategory="103"
android:showAsAction="ifRoom" />
menifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.getset"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light" >
<activity
android:name="shiransarusi.com.getset.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="shiransarusi.com.login.StudentLogIn"
android:label="#string/title_activity_student_log_in" >
</activity>
<activity
android:name="shiransarusi.com.getset.StudentMenu"
android:label="#string/title_activity_student_menu" >
</activity>
<activity
android:name="shiransarusi.com.login.StudentRegister"
android:label="#string/title_activity_student_register" >
</activity>
<activity
android:name="shiransarusi.com.getset.JSONParser"
android:label="#string/title_activity_student_register" >
</activity>
<activity
android:name="shiransarusi.com.getset.imageAdapter"
android:label="#string/title_activity_image_adapter" >
</activity>
<activity
android:name="shiransaruci.com.tasks.AllTasksActivity"
android:label="#string/title_activity_all_tasks" >
</activity>
<activity
android:name="shiransaruci.com.tasks.EditTaskActivity"
android:label="#string/title_activity_edit_task" >
</activity>
<activity
android:name="shiransaruci.com.tasks.NewTaskActivity"
android:label="#string/title_activity_new_task" >
</activity>
<activity
android:name="shiransaruci.com.tasks.SingleTask"
android:label="#string/title_activity_single_task" >
</activity>
</application>
<!--   Internet Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Documentation: menu-resource
You can try:
android:showAsAction="always|withText"
OR
android:showAsAction="always"

Related Links

How to select an image from gallery or to capture a photo and then to display it in another activity full quality
How to create MediaController which play video in videoview inside service dynamically
onFling gesture not recognized for a GridView of Buttons
I have accidentally removed FCM registration tokens from my server
How to get click event outside the activity android
How to get menu button like functionality, but without using Actionbar or in action bar area
SVGs are not loaded with support library in devices with API<21
Android: process of email confirmation using phone browser and android application
Can anyone tell me how to handle >compile: org.apache.http.legacy this error in linux?
android ListView mListView.getChildAt(i) can't be get, how to solve it?
Android Dagger and Firebase
Will my app work on a device with API7 if I compile for API24 and use the support library v7?
Speaker Recognition
Android - Host a server inside local network?
OneSignal issues when I try integrate sdk in Andriod Studio 2
How can I add a source address to google map intent from activity using “google.navigation:ll”?

Categories

HOME
eclipse
scikit-learn
eslint
redux-form
twig
youtube-data-api-v3
mysql-workbench
apiblueprint
replace
ms-access-2016
aws-cli
emscripten
discrete-mathematics
bing-maps
drop-down-menu
fhir
gson
mxgraph
redis-sentinel
favicon
glyphicons
soci
identity-management
cfml
enterprise-miner
asp.net-core-webapi
articulate-storyline
guzzle
named-entity-recognition
visual-studio-extensions
itunes
google-cloud-print
has-and-belongs-to-many
underscore.js
subclass
jbutton
angularjs-material
nested-lists
alphabetical
google-knowledge-graph
z-notation
linq-to-objects
wmp
wcftestclient
identification
video-conferencing
oracleclient
ngmaterial
arules
mouseleave
donations
visual-studio-2008-sp1
qtplugin
burrows-wheeler-transform
firebase-security
pre-build-event
refinerycms
swizzling
lua-telegram-bot
riot
project-organization
gcloud-ruby
kiosk
nullable
jnlua
inf
java-money
themoviedb-api
intel-c++
toolkit
cgi-bin
doctype
rpart
botan
google-refine
aspectj-maven-plugin
uvc
jquery-forms-plugin
zxspectrum
cross-join
webmatrix-3
jama
cuba
fpdi
ecslidingviewcontroller
openargs
bin
code-duplication
ebay-lms
neos-server
cardreader
httponly
lr
drawtobitmap
collectionviewsource
svk
non-clustered-index
openfaces
cldc
online-storage
wspbuilder

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App