Code example for ViewGroup.MarginLayoutParams

Methods: setMarginEnd

0
    /** 
     * @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;
        } 
    } 
 
    /** 
     * @see android.view.ViewGroup.MarginLayoutParams#getMarginEnd() 
     */ 
    public static int getMarginEnd(MarginLayoutParams layoutParams) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return layoutParams.getMarginEnd();
        } else { 
            return layoutParams.rightMargin;
        }