网上好多种方法都不能用,这个在4.1 上测试可以
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)){
actionbarheight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()));
}
参考:http://stackoverflow.com/questions/12301510/how-to-get-the-actionbar-height/13216807#13216807