도구 클래스 - DrawableUtils 코드로 shape 만들기

public class DrawableUtils {
    public static GradientDrawable createShape(int color){
        GradientDrawable drawable=new GradientDrawable();
        drawable.setCornerRadius(UiUtils.dip2px(5));//  4      
        drawable.setColor(color);//     
        return drawable;


    }

    public static StateListDrawable createSelectorDrawable(Drawable pressedDrawable,Drawable normalDrawable){
//      
//      
//      
//  
        StateListDrawable stateListDrawable=new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, pressedDrawable);//        
        stateListDrawable.addState(new int[]{}, normalDrawable);//        
        return stateListDrawable;

    }
}

좋은 웹페이지 즐겨찾기