how to stop activity recreation on screen orientation?

后端 未结 7 557
情话喂你
情话喂你 2020-12-10 06:25

how i can stop the restarting or recalling of on create() on screen orientation ,i want to stop the recreation of activity on screen orientation. thanks in advance please te

相关标签:
7条回答
  • 2020-12-10 07:06

    Add

    android:orientation="vertical"
    

    or

    android:orientation="horizontal"
    

    to your layout in mainwindow.xml.

    Example:::

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    

    No need to add anything in Activity class.

    Hope this may help you

    0 讨论(0)
提交回复
热议问题