Example usage for android.graphics.drawable ClipDrawable HORIZONTAL

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

Introduction

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

Prototype

int HORIZONTAL

To view the source code for android.graphics.drawable ClipDrawable HORIZONTAL.

Click Source Link

Usage

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

private void updateSeekbartheme(int color) {

    /*//from   w w w  .j  a  v a 2  s .  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);

}