Home > Mobile >  The custom view a drawable click event
The custom view a drawable click event

Time:09-30


As shown in figure, how to trigger player drawable click event, not triggers the click event of the lyrics in a custom view itself?
Determine whether trigger player drawable click event related code
//indicator picture 
Private Drawable mPlayDrawable;


 mPlayDrawable. SetBounds (mPlayRect); 


 mPlayDrawable. The 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 the x & gt; Left
& & X & lt; Right
& & Y & gt; Top
& & Y & lt; Bottom;
}

CodePudding user response:

In the view of custom calculate, button, line, time don't need to customize, three view directly set in
  • Related