Java Code Examples for android.support.v7.app.ActionBar.getHeight()

The following are Jave code examples for showing how to use getHeight() of the android.support.v7.app.ActionBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Musicoco   File: SheetSongListController.java   Source Code and License Vote up 5 votes
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);
    }
}
 
Example 2
Project: weex-3d-map   File: ScreenUtil.java   Source Code and License Vote up 5 votes
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;
}
 
Example 3
Project: chromium-for-android-56-debug-video   File: ActionModeController.java   Source Code and License Vote up 5 votes
/**
 * @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;
}