android custom view notes



------drawArc draw arc

------drawBitmap draws a bitmap
------drawCircle draws a circle
------drawLine draws a line
------drawOval draws an ellipse
------drawPath draws a path
--- ---drawPoint draw a point
------drawPoints draw multiple points
------drawRect draw a rectangle
------drawRoundRect draw a rounded rectangle
------drawText draw a string
-- ----drawTextOnPath draw a string along the path




------setARGB/setColor set the color
------setAlpha set the transparency
------setAntiAlias ​​set whether to anti-
alias ------setShader set Filling effect of the brush
------setShadowLayer Set the shadow
------setStyle Set the brush style
------setStrokeWidth Set the width of the hollow border
------setTextSize Set the size of the text when drawing text


View The provided coordinate method
getTop(): what gets is the distance from the top of the View itself to the top of its parent layout


getLeft(): Gets the distance from the left side of the View itself to the left side of its parent layout


getRight(): Gets the distance from the right side of the View itself to the right side of its parent layout


getBottom(): Gets the bottom of the View itself The distance to the bottom of its parent layout




The method provided by MotionEvent
getX(): Get the distance of the click event from the left side of the control, that is, the view coordinate


getY(): Get the distance of the click event from the top of the control, that is, the view coordinate


getRawX: Get the click event of the entire screen The distance on the left, that is, the absolute coordinate


getRawY: Get the distance from the top of the entire screen of the click event, that is, the absolute coordinate

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326320732&siteId=291194637