You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to move the button programmatically, which works fine, but I'm running into an issue when querying getLocationOnScreen(). The returning values appear to be off by half of the button width.
You should be able to see the issue with the following code:
// Set the button location
int mLocation[] = new int[2];
mButton.setX(200);
mButton.getLocationOnScreen(mLocation);
.
.
// Elsewhere (triggered in an onClick callback), try:
mButton.setX(mLocation[0]);
When I do this, the button jumps to the right, in error by half the width of the button.
I believe the error lies in the getLocation() measurement and not the setX() call, as I can set the x-location to the edge of the screen correctly.
Do you have any idea what would cause an error in the getLocation measurement? I'm guessing there's an issue in the widget correctly reporting it's size?
Any help would be greatly appreciated. And, thank you for the library.
The text was updated successfully, but these errors were encountered:
I'm trying to move the button programmatically, which works fine, but I'm running into an issue when querying getLocationOnScreen(). The returning values appear to be off by half of the button width.
You should be able to see the issue with the following code:
// Set the button location
int mLocation[] = new int[2];
mButton.setX(200);
mButton.getLocationOnScreen(mLocation);
.
.
// Elsewhere (triggered in an onClick callback), try:
mButton.setX(mLocation[0]);
When I do this, the button jumps to the right, in error by half the width of the button.
I believe the error lies in the getLocation() measurement and not the setX() call, as I can set the x-location to the edge of the screen correctly.
Do you have any idea what would cause an error in the getLocation measurement? I'm guessing there's an issue in the widget correctly reporting it's size?
Any help would be greatly appreciated. And, thank you for the library.
The text was updated successfully, but these errors were encountered: