【问题标题】:How to get x & y of a bitmap, the position of bitmap in the screen如何获取位图的 x & y,位图在屏幕中的位置
【发布时间】:2014-04-15 17:37:14
【问题描述】:

我有一个沿路径移动的位图图像,我想要的只是能够在它沿路径移动时检索位图的 x 和 y。

谢谢

【问题讨论】:

    标签: android canvas bitmap path android-drawable


    【解决方案1】:

    编辑

    我认为您的意思是 ImageView 而不是 Bitmap。您使用 Bitmap 设置 ImageView 的图像,而 Bitmap 不是视图。

    尝试使用

    int[] loc = new int[2];
    imageView.getLocationOnScreen(loc)
    

    int[] loc = new int[2];
    imageView.getLocationInWindow(loc)
    

    【讨论】:

    • 哦,对不起,你需要在视图上使用它们,试试imageView.getLocationOnScreen(loc)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多