Code example for ClipDrawable

0
            GradientDrawable bg = Utils.getShadingEx( atRight ? fg_color : bg_color, 0.6f );
            bg.setCornerRadius( 5 );
            list[0] = bg;
            GradientDrawable fg = Utils.getShadingEx( atRight ? bg_color : fg_color, 0.6f );
            fg.setCornerRadius( 5 );
            list[1] = new ClipDrawable( fg, Gravity.LEFT, ClipDrawable.HORIZONTAL );
            ld = new LayerDrawable( list );
            ld.setId( 0, android.R.id.background );
            ld.setId( 1, android.R.id.progress );
        } 
        catch( Exception e ) {
            e.printStackTrace();
        } 
        return ld;
    } 
     
    @Override 
    public void onCheckedChanged( CompoundButton buttonView, boolean isChecked ) {
        atRight = isChecked;
        if( width_seek != null ) {
            layout.removeView( width_seek );