Fix optimizing view layout