Try wrapping your calculations with parenthesis, as seen below:
Log.i("IX GETX and GETY", " " + (f.getWidth()-iv.getWidth()) + " " + (f.getHeight()-iv.getHeight()));
题
I have the following code:
Log.i("IX GETX and GETY", " " + f.getWidth()-iv.getWidth() + " " + f.getHeight()-iv.getHeight());
I get the following error: The operator - is undefined for the argument type(s) String, int
Both the getWidth and getHeight have the same calculation.
解决方案
Try wrapping your calculations with parenthesis, as seen below:
Log.i("IX GETX and GETY", " " + (f.getWidth()-iv.getWidth()) + " " + (f.getHeight()-iv.getHeight()));