Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw Dynamic Shapes

I need some help to make an activity.

I have stored coordinates from shapes and name of shapes in a database. These are grouped into rooms. In the activity I need the top of the screen 8 TextViews (with colors and textst) in two rows. If I click on a textView, accordingly the shapes for the room need to be drawn on the screen under the textViews.

If I click on a shape, I need to get back the information, on which shape I made a click.

like image 398
user1280649 Avatar asked Apr 23 '26 01:04

user1280649


1 Answers

I guess you could create a custom view:

public class CustomView extends View { ... }

and then you simply override appropriate methods like:

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

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

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

like image 85
emesx Avatar answered Apr 25 '26 15:04

emesx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!