Example usage for android.graphics.drawable ClipDrawable ClipDrawable

List of usage examples for android.graphics.drawable ClipDrawable ClipDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable ClipDrawable ClipDrawable.

Prototype

public ClipDrawable(Drawable drawable, int gravity, int orientation) 

Source Link

Document

Creates a new clip drawable with the specified gravity and orientation.

Usage

From source file:com.ksharkapps.musicnow.ui.activities.AudioPlayerActivity.java

private void updateSeekbartheme(int color) {

    /*/*from ww w. j  a va  2s.  co  m*/
     * ShapeDrawable pgDrawable = new ShapeDrawable(new RectShape());
     * 
     * // Sets the progressBar color pgDrawable.getPaint().setColor(color);
     * 
     * // Adds the drawable to your progressBar ClipDrawable progress = new
     * ClipDrawable(pgDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
     * mProgress.setProgressDrawable(progress);
     * mProgress.setBackgroundDrawable
     * (getResources().getDrawable(R.drawable.progress_shape));
     */

    ShapeDrawable shape = new ShapeDrawable();
    shape.getPaint().setStyle(Style.FILL);
    shape.getPaint().setColor(getResources().getColor(R.color.transparent_black));

    ShapeDrawable shapeD = new ShapeDrawable();
    shapeD.getPaint().setStyle(Style.FILL);
    shapeD.getPaint().setColor(getResources().getColor(R.color.white));
    ClipDrawable clipDrawable = new ClipDrawable(shapeD, Gravity.LEFT, ClipDrawable.HORIZONTAL);

    LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { shape, clipDrawable });
    mProgress.setProgressDrawable(layerDrawable);

}