Back to project page android.
The source code is released under:
Apache License
If you think the Android project android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.digin.android; //from ww w .j av a 2 s . c o m import android.content.Context; import android.content.res.TypedArray; import android.view.View; import android.view.ViewGroup; /** * Created by david on 8/10/14. */ public class Utils { public static void fixForActionBarHeight(Context context, View view) { final TypedArray styledAttributes = context.obtainStyledAttributes( new int[]{android.R.attr.actionBarSize}); int actionBarSize = (int) styledAttributes.getDimension(0, 0); styledAttributes.recycle(); if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); p.setMargins(p.leftMargin, actionBarSize, p.rightMargin, p.bottomMargin); view.requestLayout(); } } }