Code example for Drawable

Methods: getOpacity

0
        public void setColorFilter(ColorFilter cf) {
            mRealDrawable.setColorFilter(cf);
        } 
        @Override 
        public int getOpacity() { 
            return mRealDrawable.getOpacity();
        } 
    } 
 
    public TargetDrawable(Resources res, int resId) {
        mResourceId = resId;
        setDrawable(res, resId);
    } 
 
    public void setDrawable(Resources res, int resId) {
        // Note we explicitly don't set mResourceId to resId since we allow the drawable to be 
        // swapped at runtime and want to re-use the existing resource id for identification. 
        Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
        // Mutate the drawable so we can animate shared drawable properties. 
        mDrawable = drawable != null ? drawable.mutate() : null;
        resizeDrawables();