In my activity, I have an action mode with a single element that has a title and icon.
I want the title and icon to be displayed, so I use the SHOW_AS_ACTION_WITH_TEXT and SHOW_AS_ACTION_ALWAYS flags.
In landscape orientation, this is beautiful. I have a title + icon. But in portrait orientation only the icon is displayed (although there is a lot of free space). Does anyone know what I can do to fix this?
Please note that the title is displayed correctly if I delete the icon.
Here is my sample code:
public class TestActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startActionMode(new Callback() { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add("Item 1").setIcon(R.drawable.ic_launcher).setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public void onDestroyActionMode(ActionMode mode) { } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } }); } }
source share