get ActionBar Height Dip - Android User Interface

Android examples for User Interface:ActionBar Size

Description

get ActionBar Height Dip

Demo Code


import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.util.TypedValue;
import android.widget.FrameLayout;

public class Main{
    public static int getActionBarHeightDip(Context c) {
        float scale = c.getResources().getDisplayMetrics().density;
        return (int) ((48 * scale) + 0.5);
    }/*from   w  w w  .  ja  v a2  s.  co  m*/
}

Related Tutorials