SCREEN_ORIENTATION_LANDSCAPE upside down - Why?

后端 未结 4 833
眼角桃花
眼角桃花 2021-01-11 13:16

I am using the following code to set orientation locking per user preference:

 private void doLock(boolean locked) {
     if (locked) {
       int o = getRes         


        
4条回答
  •  清酒与你
    2021-01-11 14:06

    try with universal landscape orientation

    private static final int ORIENTATION_90 = 1;
    private static final int ORIENTATION_0 = 0;
    private static final int ORIENTATION_180 = 2;
    private static final int ORIENTATION_270 = 3;
    
    switch (orientation)
        {
          default:
          case ORIENTATION_0: // Portrait
            //dostuff
            break;
          case ORIENTATION_90: // Landscape left
            //do stuff
            break;
          case ORIENTATION_180: // Upside down.
            //do stuff
            break;
          case ORIENTATION_270: // Landscape right
            //do stuff
            break;
          }
    

提交回复
热议问题