Wednesday 14 January 2015

Show icons in Action Bar

Try this code

1) Using android default action bar
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
 <item android:id="@+id/action_search"
      android:icon="@drawable/ic_action_search"
      android:title="@string/action_search"
      android:showAsAction="always"       
  />
</menu>
 
2) If using supported action bar
 <menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
  <item android:id="@+id/action_search"
      android:icon="@drawable/ic_action_search"
      android:title="@string/action_search"
      yourapp:showAsAction="always"    
  />
 </menu>
 
 
for more info u can refer to this link
http://developer.android.com/guide/topics/ui/actionbar.html

No comments:

Post a Comment