美文网首页
Android中Drawable类型判断过程

Android中Drawable类型判断过程

作者: xinguoshui | 来源:发表于2019-02-13 16:02 被阅读0次
    // android.graphics.drawable.DrawableInflater.java
    
        private Drawable inflateFromTag(@NonNull String name) {
            switch (name) {
                case "selector":
                    return new StateListDrawable();
                case "animated-selector":
                    return new AnimatedStateListDrawable();
                case "level-list":
                    return new LevelListDrawable();
                case "layer-list":
                    return new LayerDrawable();
                case "transition":
                    return new TransitionDrawable();
                case "ripple":
                    return new RippleDrawable();
                case "adaptive-icon":
                    return new AdaptiveIconDrawable();
                case "color":
                    return new ColorDrawable();
                case "shape":
                    return new GradientDrawable();
                case "vector":
                    return new VectorDrawable();
                case "animated-vector":
                    return new AnimatedVectorDrawable();
                case "scale":
                    return new ScaleDrawable();
                case "clip":
                    return new ClipDrawable();
                case "rotate":
                    return new RotateDrawable();
                case "animated-rotate":
                    return new AnimatedRotateDrawable();
                case "animation-list":
                    return new AnimationDrawable();
                case "inset":
                    return new InsetDrawable();
                case "bitmap":
                    return new BitmapDrawable();
                case "nine-patch":
                    return new NinePatchDrawable();
                default:
                    return null;
            }
        }
    
    

    相关文章

      网友评论

          本文标题:Android中Drawable类型判断过程

          本文链接:https://www.haomeiwen.com/subject/vhedeqtx.html