File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 4
4
import android .graphics .Canvas ;
5
5
import android .graphics .Color ;
6
6
import android .graphics .Paint ;
7
+ import android .view .MotionEvent ;
7
8
import android .view .View ;
9
+ import android .widget .Toast ;
8
10
9
11
public class SampleView extends View {
10
12
11
13
private Paint paint = new Paint ();
12
14
public SampleView (Context context ) {
13
15
super (context );
14
- setBackgroundColor (Color .BLUE );
16
+ setBackgroundColor (Color .WHITE );
15
17
}
16
18
17
19
@ Override
18
20
public void onDraw (Canvas canvas ){
19
- canvas .drawText ( "Hello" , 100 , 100 , paint );
21
+ canvas .drawCircle ( 100 , 100 , 20 , paint );
20
22
}
21
23
24
+ @ Override
25
+ public boolean onTouchEvent (MotionEvent event ){
26
+ Toast .makeText (getContext (), "Touch" , Toast .LENGTH_SHORT ).show ();
27
+ return true ;
28
+ }
22
29
}
You can’t perform that action at this time.
0 commit comments