I have used recyclerview in a fragment. If activity's configChanges includes orientation, recycler view appears in the middle of the screen after phone orientation changes from landscape to portrait. However it should be on top always. If configChanges does not include orientation, it always appear on top on orientation changes.
Do you have any idea what it is the reason?
This is the activity layout
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.butterfly.LoginActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/butterflypi_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top|start" />
</android.support.design.widget.CoordinatorLayout>
This is the fragment layout replaces framelayout above.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
tools:context="com.butterfly.fragment.ButterflyPIsFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_pi_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
/>
</RelativeLayout>