Closed rishi-livewiretax closed 10 years ago
Hello. I haven't seen this before, but I have a haunch. On the javascript side, width/height and top/left are calculated and then passed to Android. The most logical reason why this is happening is that the javascript width is not the same as the android width.
If this is the case, one idea for a fix is to always pass in the javascript full width and full height of the screen into the android code. In android, we get the full width and height in Java. Then, we can get js/java ratio. Whenever we set the position/dimensions of the views, we do: mProperty.getInt * (js width/java width)
What do you think?
Yeah, you're right. The disparity is in the viewport size vs the entire browser window's size.
For example window.outerWidth
and window.outerHeight
both match the size that android is reporting. However, window.innerWidth
and window.innerHeight
are the correct measurement (half the size on my phone).
So, there's actually no need to get the size in android. We can just give a ratio of window.outerWidth / window.innerWidth
#67 fixes this.
Closed, as issue was resolved by #67
I did what you said above. But not working.
I'm having the same issue as #20 .
When I change the code here, it works perfectly. Basically, my views were half the size and positioning they should have been, and multiplying by 2 fixed the problem.
What I did was (multiply by 2):
and
Doing the above makes it work perfectly:
I could submit a pull request, however, I have no clue why I need to multiply by two. When I check logcat, it's reporting the correct positions and correct width/height, so I don't know why the views are half-positioned and half-sized.