Skip to content

3. Rotation and Size Changes

Zardozz edited this page Mar 21, 2021 · 1 revision

When a Rotation or Size configuration change happens the Activity does not need to be recreated to get the FixedHeaderTableLayout to adjust to the new rotation or size.

The calculatePanScale method of FixedHeaderTableLayout can be called with "no change" values in the onConfigurationChanged activity method.
e.g.

// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
    // Redraw screen calculating the new boundaries without new pan or scale
    fixedHeaderTableLayout.calculatePanScale(0,0,1f);
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
    // Redraw screen calculating the new boundaries without new pan or scale
    fixedHeaderTableLayout.calculatePanScale(0,0,1f);
}

This will ensure the table stays within the new screen bounds.