I wanted to make a toolbar with image above it which would collapse upon scrolling the view below it but on some devices it causes a huge performance issue. Scrolling is painfully slow and I don't get why. On Samsung Galaxy S2 it works perfect but on S7 it's super super slow.
app_bar_layout.xml
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/toolbar_image"
android:src="@drawable/sky"
android:layout_width="match_parent"
android:layout_height="120dp"
android:scaleType="centerCrop"
app:layout_scrollFlags="scroll|enterAlways"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/actionbar_size"
android:background="@color/colorPrimary">
<me.grantland.widget.AutofitTextView
android:id="@+id/autofix_toolbar_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="2"
android:gravity="center_vertical"
android:textSize="23sp"
autofit:minTextSize="23sp"
android:text="@string/app_name"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<FrameLayout
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
What folder is your sky image stored in? and what size is it? I had a very similar issue and it turned out it was because the image was in the wrong drawable folder and being scaled differently to what I expected. See this post: https://littlelostandroid.wordpress.com/2016/04/23/mishaps-with-bitmaps-part-1/