简体   繁体   中英

How to move the origin of an Android View into its center?

I made an own Joystick-View and now I have to calculate the distance between the point the user is dragging to and the center of the view. This would be much easier if I can translate the origin of the view from the left top (actual origin) to the center (new origin)!

Does anyone know how to do this?

My View, schematic:

如果您的视图是ImageView,请将imageView.scaleType更改为ImageView.ScaleType.CENTER。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM