get View Horizontal Margin Sum - Android User Interface

Android examples for User Interface:View Margin

Description

get View Horizontal Margin Sum

Demo Code


//package com.java2s;

import android.view.View;
import android.view.ViewGroup;

public class Main {
    public static int getHorizontalMarginSum(View v) {
        ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v
                .getLayoutParams();//from   www.  j  a v  a2 s  .  co  m
        return mlp.leftMargin + mlp.rightMargin;
    }
}

Related Tutorials