I've implemented a navigation drawer in my app as instructed in the android documentation.
Everything is working fine but as some of my fragments are using tabs I would like to 'scroll out' the tabviews simultaneously as the drawer is expanded. Like illustrated here:
The onDrawerSlide() method from my actionBarToggle would be perfect for it as it passes the percentage of how far the drawer is expanded.
I changed the navigationmode of the actionbar in actionBarToggle's onDrawerOpened() and onDrawerClosed() methods and everything is working well. But I want some kind of animation because it's looking very brusque at the moment.
[Drawer opened - puff tabs are gone puff; Drawer closed- puff tabs are there again puff]
My current code.
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle =
new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer,
R.string.navigation, R.string.closed) {
public void onDrawerClosed(View view) {
supportInvalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
setTitle(getString(R.string.navigation));
setIcon(R.drawable.abc_ic_search_api_holo_light);
supportInvalidateOptionsMenu();
}
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
// TODO animation
super.onDrawerSlide(drawerView, slideOffset);
}
};
I expect something like getting the tabhost/view or whatever and setting it's height depending on the slideOffset.
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
TabView tabView = actionBar.getTabView(); // how do I get the view where the tabs are shown?
ViewGroup.LayoutParams tabViewLayoutParams = tabView.getLayoutParams();
ViewGroup.LayoutParams tabViewNewLayoutParams = new ViewGroup.LayoutParams(a.width, (int)((1 - slideOffset) * normalTabHeight))
drawer.setLayoutParams(tabViewNewLayoutParams );
super.onDrawerSlide(drawerView, slideOffset);
}
How can I get the view where the tabs are in?

I'm using the support library for API 7+ and thus the SupportActionBar.
How is the "tabhost" called included in the actionbar? Is it even possible to get this "tabview/host" and change the height of it on runtime programmatically?