1

how to make the menu icon display at beside of the title like below the action bar picture? action bar

this is my program picture, is it possible to do it? please help~thanks

my program

here is my code

public void openOptionsMenu() { 
    // TODO Auto-generated method stub 
    super.openOptionsMenu(); 
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    //call the base class to include system menus
    super.onCreateOptionsMenu(menu);

        int group1 = 1;
        MenuItem bakchome = menu.add(group1,1,1,"Add News");
        bakchome.setIcon(R.drawable.ic_menu_add);

    return true;
}

@Override 
public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
        case 1:
            ProgressDialog progress1 = new ProgressDialog(News.this);
            progress1.setMessage("Loading...please wait..");
            progress1.setTitle("Planbiz");
            new MyTask(progress1).execute();
            Intent intent1 = new Intent(getApplicationContext(), News_Edit.class);

            startActivity(intent1);
            break;

        }

    return true;
}

sorry i am new user, can not upload the picture. sorry if i can't explain my question very well.

user1434388
  • 77
  • 1
  • 13

2 Answers2

1

You want your menu item to appear in the action bar I presume?

Add this to your menu item:

android:showAsAction="true"
RED_
  • 2,997
  • 4
  • 40
  • 59
1

this may help you

Implementing custom menu in android system

they also talks about customizing menus

Community
  • 1
  • 1
sunil
  • 6,444
  • 1
  • 32
  • 44