0

I'm trying to place a view at a specific point on the screen in Android.

I have a bar chart displayed using the library MPAndroidChart and when I click a bar, I want to show another view displaying the value of the bar at the position that was clicked.

I have tried implementing the "OnChartValueSelectedListener" and extracting the x, y values from the Entry callback and using that to set the x, y position of the view but no luck.

I also tried overriding the onTouch event and using the x, y coordinates from that callback to set the position of the view but it only moves the view around on the left of the screen and won't position it anywhere else such as the centre of the screen which has been the touched position.

Anyone have any solutions to be able to achieve this?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
d199224
  • 531
  • 2
  • 8
  • 23

1 Answers1

0

MPAndroidChart library already implements MarkerView which you can use for your purpose. Read the library documentation on how to use it.

Raymond Arteaga
  • 4,355
  • 19
  • 35