Fixes a bug when the width/height is set to match_parent or wrap_content.