本文整理匯總了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;
}