Check orientation on Android phone

前端 未结 23 1644
庸人自扰
庸人自扰 2020-11-22 06:26

How can I check if the Android phone is in Landscape or Portrait?

23条回答
  •  误落风尘
    2020-11-22 07:03

    I think this solution easy one

    if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
      user_todat_latout = true;
    } else {
      user_todat_latout = false;
    }
    

提交回复
热议问题