Android Open Source - android Utils

From Project

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.

Java Source Code

//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);

        if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
            ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
            p.setMargins(p.leftMargin, actionBarSize, p.rightMargin, p.bottomMargin);

Java Source Code List