To change accordingly to landscape/portrait mode

后端 未结 2 1033
余生分开走
余生分开走 2021-01-23 10:08

I have a date/time picker which I want them to react according based on its layout.

Consider on landscape mode:

This is a perfect placement of what I

2条回答
  •  伪装坚强ぢ
    2021-01-23 10:30

    When screen orientation change than activity again recreated so do this :

    int orientation = this.getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
     //code for portrait mode
    } else {
    //code for landscape mode
    }
    

    Happy coding!!

提交回复
热议问题