Fixed getting the wrong component when setting gravity.