我有以下代码:
Log.i("IX GETX and GETY", " " + f.getWidth()-iv.getWidth() + " " + f.getHeight()-iv.getHeight());
我收到以下错误:The operator - is undefined for the argument type(s) String, int
getWidth和getHeight都有相同的计算。
答案 0 :(得分:1)
尝试用括号括起你的计算,如下所示:
Log.i("IX GETX and GETY", " " + (f.getWidth()-iv.getWidth()) + " " + (f.getHeight()-iv.getHeight()));