set Layout Margin End - Android User Interface

Android examples for User Interface:Layout

Description

set Layout Margin End

Demo Code

// Copyright 2013 The Chromium Authors. All rights reserved.
//package com.java2s;

import android.os.Build;

import android.view.ViewGroup.MarginLayoutParams;

public class Main {
    /**/* w ww .j  av  a  2  s  .  c  o  m*/
     * @see android.view.ViewGroup.MarginLayoutParams#setMarginEnd(int)
     */
    public static void setMarginEnd(MarginLayoutParams layoutParams, int end) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            layoutParams.setMarginEnd(end);
        } else {
            layoutParams.rightMargin = end;
        }
    }
}

Related Tutorials