I want my app to change different parts of the UI when the resolution is big enough and is on landscape mode, and detect changes while the app is running (screen rotation on a mobile device, for instance).
I know that I should have an event listen to the screen resolution (which can be obtained via javascript), but I don't know how to do this. How do I hang an event on a always refreshing value?
You want Window.addResizeHandler
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
yourCustomLayoutAdjustmentMethod(event.getHeight(), event.getWidth());
}
});
No JavaScript required!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With