center And Pad View - Android User Interface

Android examples for User Interface:View Center

Description

center And Pad View

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static void centerAndPadView(View view, int padding) {
        view.setPaddingRelative(padding, padding, padding, padding);
        view.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
        view.requestLayout();/*  ww  w  . j a v  a  2s  . c  om*/
    }
}

Related Tutorials