Example usage for android.graphics.drawable Drawable setHotspot

List of usage examples for android.graphics.drawable Drawable setHotspot

Introduction

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

Prototype

public void setHotspot(float x, float y) 

Source Link

Document

Specifies the hotspot's location within the drawable.

Usage

From source file:cnedu.ustcjd.widget.MultiSlider.java

private void setHotspot(float x, float y, Thumb thumb) {
    if (thumb == null || thumb.getThumb() == null)
        return;/*from   w  w w.j a  va  2s  . c  o  m*/
    final Drawable background = getBackground();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && background != null) {
        background.setHotspot(x, y);
        Rect rect = thumb.getThumb().getBounds();
        final int offsetY = getPaddingTop();
        background.setHotspotBounds(rect.left, rect.top + offsetY, rect.right, rect.bottom + offsetY);
    }
}