JakeWharton/ActionBarSherlock — Issue #207: pressing action item with submenu while swiping in viewpager gets empty sub menu items
Author: daverix
Created: 2012-01-28 00:19:33+00:00
State: open

Pressing an action item, with sub menu items, will make this weird behavior:

http://www.youtube.com/watch?v=LcyHyz3GrsQ&feature=youtu.be

I'm using ABS 4.0 beta 5 and has a ViewPager inside a fragment with an ViewPagerAdapter that loads custom views. The custom views are added dynamically when the first or last page is reached. It then calls notifyDataSetChanged() and the ViewPager does the rest. There are no action items in the fragment shown so only the activity's option menu should be used.

Here is the xml for the menu:
```xml

```

And here is the code for the menu:
```java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.menuChooseDate:
showDateDialog();
return true;
case R.id.menuToday:
loadToday();
return true;
case R.id.menuAddProject:
openAddProject();
return true;
case R.id.menuAddAbsence:
openAddAbsence();
return true;
case R.id.menuAddOvertime:
openAddOvertime();
return true;
case R.id.menuLogout:
logout();
return true;
default:
return super.onOptionsItemSelected(item);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
```

I guess it has something to do with the animations with the ViewPager that interfere with the animations of the sub menu or the other way around...