Drawing dynamic shapes

I need help to get the job done.

I have saved the coordinates from the forms and the name of the forms in the database. They are grouped into rooms. For this exercise, I need the top of the screen 8 TextViews (with colors and textst) in two rows. If I click on the textView, respectively, the shapes for the room should be drawn on the screen below the text boxes.

If I click on a shape, I need to return information on which shape I clicked on.


source to share

1 answer

I think you could create a custom view:

public class CustomView extends View { ... }


and then you just override the appropriate methods like:

public boolean onTouchEvent(MotionEvent ev) { /* check for hitting shapes here */ }

protected void onDraw(Canvas canvas) { /* draw anything you want here */ }


Use a search engine of your choice to find out more. This looks like what you need



All Articles