Added detection of layout_gravity and layout_weight