本文整理汇总了Java中android.support.v7.app.ActionBar.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.getHeight方法的具体用法?Java ActionBar.getHeight怎么用?Java ActionBar.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.getHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateRecycleViewHeight
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void calculateRecycleViewHeight() {
ActionBar bar = ((AppCompatActivity) activity).getSupportActionBar();
if (bar != null) {
int actionH = bar.getHeight();
int randomCH = randomContainer.getHeight();
int statusH = Utils.getStatusBarHeight(activity);
int screenHeight = Utils.getMetrics(activity).heightPixels;
int height = screenHeight - actionH - statusH - randomCH;
ViewGroup.LayoutParams params = songList.getLayoutParams();
params.height = height;
songList.setLayoutParams(params);
}
}
示例2: getSmartBarHeight
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private static int getSmartBarHeight(AppCompatActivity activity) {
ActionBar actionbar = activity.getSupportActionBar();
if (actionbar != null)
try {
Class c = Class.forName("com.android.internal.R$dimen");
Object obj = c.newInstance();
Field field = c.getField("mz_action_button_min_height");
int height = Integer.parseInt(field.get(obj).toString());
return activity.getResources().getDimensionPixelSize(height);
} catch (Exception e) {
e.printStackTrace();
actionbar.getHeight();
}
return 0;
}
示例3: queryCurrentActionBarHeight
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
* @return The current action bar height.
*/
private int queryCurrentActionBarHeight() {
ActionBar actionBar = mActionBarDelegate.getSupportActionBar();
if (actionBar != null) return actionBar.getHeight();
TypedArray styledAttributes =
mContext.obtainStyledAttributes(new int[] {R.attr.actionBarSize});
int height = styledAttributes.getDimensionPixelSize(0, 0);
styledAttributes.recycle();
return height;
}