I have a very strange problem: i have an activity with EditText and three buttons and two layout files for handling orientation change. When i start an app in portrait orientation and rotate the device android preserves the portrait orientation layout, but if i start an app in landscape orientation android loads an appropriate landscape layout file, but again preserves landscape layout even after rotating to portrait layout. This happens only with activity containing EditText. What's wrong? Here's my code: 1) Manifest.xml:
<activity
android:name=".AnalyzeTextActivity"
android:configChanges="orientation|screenSize|screenLayout"
android:parentActivityName=".StartScreenActivity"
android:windowSoftInputMode="adjustPan"
/>
2) portrait
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_analyze_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ADD5F7"
android:clickable="true"
android:focusableInTouchMode="true"
>
<EditText
android:layout_width="match_parent"
android:layout_height="200dp"
android:gravity="start"
android:id="@+id/edit_text_analysis"
android:hint="@string/edit_text_hint"
android:isScrollContainer="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="@+id/button_upload_file"
android:background="@drawable/button_upload_large"
android:onClick="onUploadClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/button_upload_file"
android:layout_marginTop="10dp"
android:id="@+id/button_start_analysis"
android:background="@drawable/button_start_large"
android:onClick="onStartClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/button_start_analysis"
android:layout_marginTop="50dp"
android:background="@drawable/button_clear_large"
android:onClick="onClearClicked"/>
</RelativeLayout>
3) landscape
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_analyze_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ADD5F7"
android:clickable="true"
android:focusableInTouchMode="true"
>
<EditText
android:layout_width="match_parent"
android:layout_height="200dp"
android:gravity="start"
android:id="@+id/edit_text_analysis"
android:hint="@string/edit_text_hint"
android:isScrollContainer="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edit_text_analysis"
android:layout_toLeftOf="@+id/button_start_analysis"
android:layout_marginRight="5dp"
android:id="@+id/button_upload_file"
android:layout_marginTop="2dp"
android:background="@drawable/button_upload_small"
android:onClick="onUploadClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_text_analysis"
android:layout_centerHorizontal="true"
android:layout_marginTop="2dp"
android:id="@+id/button_start_analysis"
android:background="@drawable/button_start_small"
android:onClick="onStartClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_text_analysis"
android:layout_toRightOf="@+id/button_start_analysis"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:background="@drawable/button_clear_small"
android:onClick="onClearClicked"/>
</RelativeLayout>