RecyclerView gets pushed down when returned to activity

309 views Asked by At

I'm having a really annoying problem. I have a recycler view inside my activity. The recycler view display a list of images taken by the camera. There is a FAB which takes you to the camera activity.

When I open this activity, the layout is perfect. But when I press the FAB and open the camera activity and return back, the recycler view gets pushed down to the centre of the screen.

Here is my layout:

<android.support.design.widget.CoordinatorLayout 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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="test.nick.activities.ScansActivity">


<android.support.v7.widget.RecyclerView
    android:id="@+id/listUnfinishedUploads"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/layout_padding"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <include
        android:id="@+id/app_bar"
        layout="@layout/app_bar" />
</android.support.design.widget.AppBarLayout>



<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|right"
    android:layout_marginBottom="@dimen/fab_margin"
    android:layout_marginRight="@dimen/fab_margin"
    android:src="@drawable/scan_fab"
    android:clickable="true"
    app:fabSize="normal"
    app:borderWidth="0dp"/>

<TextView
    android:id="@+id/txtMsgs"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="@dimen/margin_left"
    android:layout_marginRight="@dimen/margin_right"
    android:visibility="gone" />

I'm stuck with this for 2 hours now :(

There is a coordinatorlayout closing tag as well but for some reason it is not displaying here.

0

There are 0 answers