Compose gets the current screen orientation whether it is landscape or portrait

Read the direction attribute from the local configuration, with three values ​​in total
LocalConfiguration.current.orientation

The corresponding attribute value is in android.content.res.Configurationthe class

public static final int ORIENTATION_UNDEFINED = 0; // 未知
public static final int ORIENTATION_PORTRAIT = 1; // 竖屏
public static final int ORIENTATION_LANDSCAPE = 2; // 横屏

LocalConfiguration.currentIt contains a lot of configurations, which can be obtained from here
Insert image description here

Guess you like

Origin blog.csdn.net/qq_39420519/article/details/129318649