Hotspots are used to transmit touch events to RippleDrawable, but can also be used by custom drawings. If you are implementing a custom view that manages its own drawings, you will need to call setHotspot () from the drawableHotspotChanged () method for the series to work with touch orientation.
From View.java:
@Override public boolean onTouchEvent(MotionEvent event) { ... case MotionEvent.ACTION_MOVE: drawableHotspotChanged(x, y); ... } public void drawableHotspotChanged(float x, float y) { if (mBackground != null) { mBackground.setHotspot(x, y); } }
From FrameLayout.java, which manages its own mForeground drawable:
@Override public void drawableHotspotChanged(float x, float y) { super.drawableHotspotChanged(x, y); if (mForeground != null) { mForeground.setHotspot(x, y); } }
alanv source share