Android studio Android应用程序定位问题
我正在使用android studio做一个项目。我已将我的Android studio Android应用程序定位问题,android-studio,Android Studio,我正在使用android studio做一个项目。我已将我的网站转换为android应用程序。在我的android应用程序中当我将我的android手机的方向从垂直模式更改为水平模式时,我的应用程序会从第一页重新加载。 android应用程序代码如下所示 activity\u main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:and
网站
转换为android应用程序
。在我的android应用程序中
当我将我的android手机的方向从垂直模式更改为水平模式时
,我的应用程序会从第一页重新加载。
android应用程序代码如下所示
activity\u main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.nandha.firstproject.MainActivity">
<WebView
android:id="@+id/myWebView"
android:layout_width="368dp"
android:layout_height="495dp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nandha.firstproject">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.nandha.firstproject.MainActivity">
<WebView
android:id="@+id/myWebView"
android:layout_width="368dp"
android:layout_height="495dp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nandha.firstproject">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
当我将方向更改为水平模式时,它会从第一页重新加载,如下所示
现在,我只需要水平模式下的页面,我将其更改为水平方向,而不需要上一页的页面。
我的问题是我只在第二页将方向更改为水平模式。但是,我的应用程序从第一页开始以水平方向重新加载
请帮助我解决此问题。尝试在更改方向时不重新加载:实际上,当我将方向更改为横向时,页面会自动重新加载。如何修复它?