Android examples for Graphics:Drawable
get Current Drawable from View
//package com.book2s; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.view.View; public class Main { static LayerDrawable getCurrentDrawable(View view) { final Drawable currentDrawable = view.getBackground(); if (currentDrawable == null) { return new LayerDrawable(new Drawable[0]); } else if (currentDrawable instanceof LayerDrawable) { return (LayerDrawable) currentDrawable; } else {//from w w w . ja va2 s. c o m return new LayerDrawable(new Drawable[] { currentDrawable }); } } }