Sets a view's right padding while retaining the padding from other sides - Android User Interface

Android examples for User Interface:View Padding

Description

Sets a view's right padding while retaining the padding from other sides

Demo Code


//package com.java2s;

import android.support.annotation.NonNull;

import android.view.View;

public class Main {
    /**/*from   w w w.  java  2 s  . c o  m*/
     * Sets a view's right padding while retaining the padding from other sides
     *
     * @param view       the input view
     * @param newPadding the new right padding in pixels
     */
    public static void setPaddingRight(@NonNull View view, int newPadding) {
        view.setPadding(view.getPaddingLeft(), view.getPaddingTop(),
                newPadding, view.getPaddingBottom());
    }
}

Related Tutorials