set View Background - Android User Interface

Android examples for User Interface:View Background

Description

set View Background

Demo Code


//package com.java2s;

import android.graphics.drawable.Drawable;

import android.view.View;

public class Main {
    public static void setBackground(View view, Drawable drawable) {
        //In case of Newer Version
        if (android.os.Build.VERSION.SDK_INT >= 16) {
            view.setBackground(drawable);
        } else {//from  ww  w  .ja v  a  2s.c  om
            view.setBackgroundDrawable(drawable);
        }
    }
}

Related Tutorials