Punkty aktywne służą do kierowania zdarzeń dotyku do formatu RippleDrawable, ale mogą być również używane przez niestandardowe rysunki. Jeśli implementujesz niestandardowy widok, który zarządza własnymi rysunkami, będziesz musiał wywołać setHotspot() z metody drawableHotspotChanged(), aby marchety skoncentrowane na dotyk działały poprawnie.
Od View.java:
@Override
public boolean onTouchEvent(MotionEvent event) {
...
case MotionEvent.ACTION_MOVE:
drawableHotspotChanged(x, y);
...
}
/**
* This function is called whenever the view hotspot changes and needs to
* be propagated to drawables managed by the view.
* <p>
* Be sure to call through to the superclass when overriding this function.
*
* @param x hotspot x coordinate
* @param y hotspot y coordinate
*/
public void drawableHotspotChanged(float x, float y) {
if (mBackground != null) {
mBackground.setHotspot(x, y);
}
}
Od FrameLayout.java, która zarządza własną mForeground rozciągliwej:
@Override
public void drawableHotspotChanged(float x, float y) {
super.drawableHotspotChanged(x, y);
if (mForeground != null) {
mForeground.setHotspot(x, y);
}
}
znalazłem ten artykuł (ale to jest stary): http: // blahti .wordpress.com/2012/06/26/images-with-clickable-areas/Może ten hotspot ma to samo znaczenie ... – krossovochkin
Nos, to współrzędne punktu ustawionego jako dotykowe? –