handle the layout change for the View

Change-Id: I0b228501aca466b09554fea2631de5068114a885
Clean the code

Change-Id: I4422dd8fa23576c816b99a3a94262f37b8f8e777