Can someone give me an example of how to get the center coordinates of the current displayed screen? I would like my objects to always be relative to the center coordinates of the active view.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
Here is how I resolved the issue. As a background, I have a button that once the user moves the map to the desired location (cross hairs showing the centre of map) they can tap the button and a marker appears in the centre of the map.
You can try with
DisplayMetrics
to achieve your solutionint cx =screenHeight = displaymetrics.heightPixels; int cy = screenWidth = displaymetrics.widthPixels; float finalRadius = (float) Math.sqrt(cx * cx + cy * cy);
float is the center if the object