-1
<item
    android:id="@+id/notification_button"
    android:actionLayout="@layout/notification_count"
    android:title="Badges"
    android:showAsAction="always">

The ActionLayout is not working but title is showing, how can I fix this ?

Krishna
  • 706
  • 5
  • 22
jojo
  • 461
  • 2
  • 5
  • 17

1 Answers1

0

MainActivity

@Override
        public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
       switch (item.getItemId()) 
       {
         case R.id.search:  // it is going to refer the search id name in main.xml

         //add your code here

            return true;
         default:
            return super.onOptionsItemSelected(item);
       }
    }

main.xml

<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" >

    <item
        android:id="@+id/search"
        android:icon="@drawable/ic_action_settings"  --> add a icon in drawable that will display in the top of the action bar.
        android:title="@string/search"
        android:showAsAction="always"/>

</menu>
Krishna
  • 706
  • 5
  • 22
  • need custum action bar.. plz help – jojo May 09 '16 at 13:28
  • [http://stackoverflow.com/questions/15518414/how-can-i-implement-custom-action-bar-with-custom-buttons-in-android](http://stackoverflow.com/questions/15518414/how-can-i-implement-custom-action-bar-with-custom-buttons-in-android) check this – Krishna May 09 '16 at 13:30