Jake Wharton's answer does not work if you're handling configuration changes.
This is how I solved this problem by code, in case it helps anyone:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
layoutTheView();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
layoutTheView();
}
private void layoutTheView() {
ActionBar actionBar = this.getSupportActionBar();
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mTheView.getLayoutParams();
int actionBarHeight = actionBar.getHeight();
params.setMargins(0, actionBarHeight, 0, 0);
mTheView.setLayoutParams(params);
mTheView.requestLayout();
}