CustomResourceMgmt.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:letv 作者:
public Drawable getCheckStatusDrawable(String origin, String checked, String pressed, String checkpressed, boolean is9Png) {
    int originId = this.mResources.getIdentifier(origin, "drawable", this.packageName);
    int selectId = this.mResources.getIdentifier(checked, "drawable", this.packageName);
    int pressedId = this.mResources.getIdentifier(pressed, "drawable", this.packageName);
    int selectpressId = this.mResources.getIdentifier(checkpressed, "drawable", this.packageName);
    if (originId == 0 && selectId == 0 && pressedId == 0 && selectpressId == 0) {
        String suffix = (is9Png ? ".9" : "") + ".png";
        return new StateListDrawableBuilder(this.mContext, "drawable/" + origin + suffix).setPressDrawable("drawable/" + pressed + suffix).setCheckedDrawable("drawable/" + checked + suffix).setPressCheckedDrawable("drawable/" + checkpressed + suffix).create();
    }
    Drawable mStateListDrawable = new StateListDrawable();
    mStateListDrawable.addState(new int[]{16842912}, this.mResources.getDrawable(selectId));
    mStateListDrawable.addState(new int[]{16842919}, this.mResources.getDrawable(pressedId));
    mStateListDrawable.addState(new int[]{16842919, 16842912}, this.mResources.getDrawable(selectpressId));
    mStateListDrawable.addState(new int[0], this.mResources.getDrawable(originId));
    return mStateListDrawable;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号