版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zsp_android_com/article/details/84839984
简介
xxx
高
getActionBar().getHeight();
工具类
package util;
import android.content.Context;
import android.util.TypedValue;
/**
* Created on 2018/12/5.
*
* @desc 动作栏
*/
public class ActionBarUtils {
/**
* 动作栏高
*
* @param context 上下文
* @return 高
*/
public static int actionBarHeight(Context context) {
TypedValue tv = new TypedValue();
int actionBarHeight = 0;
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
}
return actionBarHeight;
}
}