Android image with clickable areas

后端 未结 4 1344
自闭症患者
自闭症患者 2021-01-03 13:52

I need an advice how to achieve the following functionality under Android:

  • I need an image that represents something like a graph (from discrete math), with ve
4条回答
  •  死守一世寂寞
    2021-01-03 14:52

    According to android help, "drawing to a View, is your best choice when you want to draw simple graphics that do not need to change dynamically and are not part of a performance-intensive game." This is the right way to go when making a snake or a chess game, for instance. So I don't see a point in suggesting using a SurfaceView for this, it will just overcomplicate things.

    For clickable areas you override public boolean onTouchEvent(MotionEvent event) where you manage x and y coordinates of the click for identifying the clicked area.

提交回复
热议问题