
如圖,如何在觸發播放drawable點擊事件的時候,不觸發歌詞自定義view本身的點擊事件?
判斷是否觸發播放drawable點擊事件的相關代碼
// 指示器圖片
private Drawable mPlayDrawable;
mPlayDrawable.setBounds(mPlayRect);
mPlayDrawable.draw(canvas);
private boolean onClickPlayButton(MotionEvent event) {
float left = mPlayRect.left;
float right = mPlayRect.right;
float top = mHeight / 2 - mIconHeight;
float bottom = top + mIconHeight * 2;
float x = event.getX();
float y = event.getY();
return x > left
&& x < right
&& y > top
&& y < bottom;
}
uj5u.com熱心網友回復:
里面的view自定義就算了,按鈕、線、時間沒必要自定義,直接3個view套進去就行了轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/98566.html
標籤:Android
