I'm using AppBarLayout in CoordinatorLayout wiht RecyclerView to have a parallax like effect.
For the most part it behaves as it should, but on ocasion when scrolling down, the AppBarLayout would collapse as if it was being scrolled up.
Problem is I can't reliably reproduce the bug to figure out why that's going on.
Here is my XML layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="#+id/coordinatorLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/white_background">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="#+id/relativeLayoutTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">
<ImageView
android:id="#+id/imageViewImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="#null"
android:adjustViewBounds="true"/>
<TextView
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:id="#+id/textViewBuild"
android:textSize="16sp"
android:textColor="#color/white_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="smartfactory.ch.frink.widgets.PatchedScrollingViewBehavior">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:layout_behavior="smartfactory.ch.frink.widgets.PatchedScrollingViewBehavior"/>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
Here's the video showing the bug (3rd drag, at roughly 10 second)
My question: Has anyone else encountered this bug and found a way how to fix it?
EDIT:
After a lot of digging, it seems that there was an issue that was fixed with the v23.1, however the above example was compiled with the v23.1, and the bug still persists, so hoping someone will see this and either tell me what I'm doing wrong or hopefully re-open the ticket.
Related
i have this issue where my recyclerview does not do nestedscrolling on api 19 (lollipop) ...on latest version of android its ok.
using following dependency: com.android.support:design:26.1.0
and what i have created is a recyclerview that should have a sticky header. the header is in a cardview and the list items are below the cardview. it looks like this:
detailscreen.xml:
<!--wrapping in RelativeLayout until this is resolved: https://stackoverflow.com/questions/57142959/why-latest-version-constraintlayout-doesnt-work-in-nestedscrollview-with-coordi-->
<RelativeLayout 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"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:id="#+id/headerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/ride_hail_meet_at"
android:textColor="#388bf2"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_weatherdata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintLeft_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_description"
tools:itemCount="3"
tools:listitem="#layout/weather_data_row_item"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/headerView"
android:layout_alignParentBottom="true"
android:background="#color/white">
<!-- THIS IS THE RECYCLERVIEW GIVING ME THE PROBLEMS. ITS NOT SCROLLING ON API 19 , WHY ??? -->
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_directions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="5"
tools:listitem="#layout/ride_direction_row" />
</RelativeLayout>
when i inflate this thing its placed inside a CoordinatorLayout customView. that container itself can be scrolled. What am i doing wrong that it works on recent versions of android but not lollipop ? i even tried using a appBarLayout and putting my headerView in that but same thing just on older version of android, not working. im open to changing the xml entirely if you can suggest a better approach ?
note: setting android:nestedScrollingEnabled = false is going to cause my recyclerView not to recyclerviews. i have big images in the list so i need this feature.
You'd have to set android:layout_height to match_parent or a fixed size.
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent" />
If you set it to wrap_content it'll expand to the size of its content and thus not scroll.
so odd this is the only way i could get it resolved:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="bottom"
app:expandedTitleMarginEnd="#dimen/activity_horizontal_margin"
app:expandedTitleMarginStart="#dimen/activity_horizontal_margin"
app:layout_scrollFlags="noScroll"
app:title="#string/app_name">
<ImageView
android:id="#+id/toolbar_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="#null"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/beach_huts" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
so strange this works for everything ..thanks everyone. they key thing is i need to put the recyclerView FIRST above everything else. then define the appbar stuff afterwards.
I am a Android newbie programmer and I am stuck with a UI problem. My goal is to achieve something closer to this:
desirable layout
I thought about it and I decided to do it with a CoordinatorLayout, AppBarLayout / CollapsingToolbarLayout and a NestedScrollView with a CardView. Sounds just fine for this problem, right?
With my actual XML I already have the toolbar, image and the scroll feature.
However, the scroll feature isn't 100% like I wanted. First of all, it's not possible to scroll down since around mid screen (probably because of android:layout_height="275dp"), it is only possible to scroll up. (and of course collapse the toolbar). My main goal is to "open" the image fullscreen. Do you have any idea how can I achieve this behaviour? Maybe controlling % in .java?
Also have one annoying bug, but I can leave with it for now, just try to help if it also gives you some OCD condition
I tried to add an transparent property to my LinearLayout but it didn't work.
Normal scroll:
Current scroll
Buggy 'panel' as it is close to collapse:
buggy panel image
My all XML:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/annonce.main.coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="RtlHardcoded"
>
<android.support.design.widget.AppBarLayout
android:id="#+id/flexible.example.appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/flexible_example_collapsing"
android:layout_width="match_parent"
android:layout_height="275dp"
app:title="Mosteiro dos Jerónimos"
app:expandedTitleMarginBottom="94dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleTextAppearance="#style/CollapsingTextAppearance.Inverse"
app:contentScrim="?attr/colorPrimary"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:src="#drawable/mosteiro_dos_jeronimos"
android:scaleType="centerCrop"
/>
<android.support.v7.widget.Toolbar
android:id="#+id/flexible.example.toolbar"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#null"
app:layout_collapseMode="pin"
app:title="Mosteiro dos Jerónimos"
style="#style/ToolBarWithNavigationBack"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:behavior_overlapTop="78dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.v7.widget.CardView
android:id="#+id/flexible.example.cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentPaddingBottom="16dp"
app:contentPaddingLeft="16dp"
app:contentPaddingRight="16dp"
app:cardCornerRadius="16dp"
app:cardBackgroundColor="#android:color/white"
app:cardElevation="4dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<View
android:id="#+id/myRectangleView"
android:layout_width="40dp"
android:layout_height="4dp"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:background="#drawable/rectangle"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Lisboa"
android:textAppearance="#style/TextAppearance.Header"
style="#style/TextComponent.ItemRow"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:lineSpacingExtra="8dp"
android:textSize="16sp"
android:text="#string/lorem"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/flexible.example.fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="32dp"
android:elevation="8dp"
android:src="#drawable/ic_adb_24dp"
app:layout_anchor="#id/flexible.example.cardview"
app:layout_anchorGravity="top|right|end"
tools:ignore="RtlHardcoded"
/>
</android.support.design.widget.CoordinatorLayout>
I think your layout is fine (works on my side), but maybe the behavior you want is more something like a Bottomsheet behavior.
Have you had a look at it?
Basically this will make you able something like google maps, so you would be able to scroll like you want.
Here is a tutorial to have a better understanding of what it is like.
Please let me know if this is what you're looking for.
Here is a link to the whole project so that you can reproduce the problem:
https://github.com/FaridArbai/TapExchange/tree/master/TapExchange
I would like to ask for help with an issue that I've been struggling with for about two days and yet found no solution in spite of the thorough research that I have done.
Basically, I have an AppBarLayout with a CollapsingToolbarLayout inside whose mission is to collapse a background image when the user scrolls down a RecyclerView of CardViews. The problem arises when I try to scroll down that RecyclerView once the Image is fully collapsed: It won't scroll if I touch one of the cardviews that compose the RecyclerView!
Here is the look with no collapse (here I can scroll with no problem):
Uncollapsed Image, able to scroll in any direction
And here is the look once the image is collapsed (here I cannot scroll down if my finger touches any cardview that compose the RecyclerView):
Collapsed Image, unable to scroll down if I touch one of the cardviews
The code for the whole layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".profiles.PersonalProfile"
android:background="#FCFCFC">
<android.support.design.widget.AppBarLayout
android:id="#+id/personal_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/personal_collapsing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:contentScrim="?attr/colorPrimary"
app:title=""
app:titleEnabled="false">
<ImageView
android:id="#+id/personal_image_background"
android:layout_width="match_parent"
android:layout_height="340dp"
android:scaleType="centerCrop"
android:src="#drawable/profile_background"/>
<android.support.v7.widget.Toolbar
android:id="#+id/personal_toolbar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:title="">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Space
android:id="#+id/avatar_collapsed_target"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="0dp"/>
<TextView
android:id="#+id/personal_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:text="Unknown Username"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/section_selection_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:srcCompat="#drawable/ic_action_add" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/personal_image_foreground"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="120dp"
android:layout_gravity="top|center_horizontal"
android:src="#drawable/executive"
app:collapsedTarget="#id/avatar_collapsed_target"
app:layout_behavior="com.faridarbai.tapexchange.graphical.CollapsingAvatarBehavior"
android:elevation="5dp"/>
<LinearLayout
android:id="#+id/personal_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_anchor="#id/personal_image_foreground"
app:layout_anchorGravity="bottom|center"
android:paddingTop="30dp">
<TextView
android:id="#+id/username_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unknown Username"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/personal_nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/personal_sections_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I am building with the API 25 and using GUI utilities from version 25.4.0. I would be extremely grateful if anybody can help.
Thanks
EDIT
I tried with SDK nº 27 and 27.1.1 building tools, supressed both "snap" and the NestedScrollView and still got the same problem: Once the background image has collapsed the RecyclerView is unable to scroll up if I initially put my finger on a CardView from the RecyclerView. This is quite odd because WhatsApp, Facebook and Telegram use a very similar Layout and they don't have this problem so there should be a well accepted work around.
Anyone to help?
why you are using RecyclerView inside NestedScrollView?!. if yo have more items with different layouts you can use recyclerView With different ViewTypes but i won't recommend to use it inside NestedScrollView try to use it Directly and don't forget to put this app:layout_behavior="#string/appbar_scrolling_view_behavior" in the recylerView and it will work.
I'm using CoordinatorLayout with CollapsingToolBar and NestedScrollView. The elements are being inserted via RecyclerView. Whenever I try to scroll up or down the scroll isn't smooth, it's very slow, regardless the velocity of the gesture. I tried the solution here but it didn't solve my problem.
So I have no idea what causes this problem or how to solve it.
Here is my xml layout
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/main_screen_frame">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="225dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="#+id/toolbarImage"
android:layout_width="150dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="#drawable/logo"
android:layout_gravity="center"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
android:layout_gravity="bottom"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.SearchView
android:id="#+id/search_view_id"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:queryHint="#string/search_view_hint"
android:queryBackground="#color/colorWhite"
android:layout_gravity="right"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/search_panel_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layoutDirection="rtl">
<TextView
android:id="#+id/text_view_id"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAlignment="center"
android:text="#string/secondary_title"
android:layout_marginBottom="5dp"/>
</LinearLayout>
<FrameLayout
android:id="#+id/fragment_layout_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/search_panel_id"
android:layout_marginTop="10dp"
android:orientation="horizontal">
</FrameLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
The FrameLayout is a place holder for different fragments with different scrollable RecyclerViews.
Thanks in advance.
Layout structure seems okay. So the problem might be here. android:src="#drawable/logo".
Try moving it to drawable-nodpi directory.
Also loading with Picasso / Glide will improve perfomance.
Solved my problem with this solution. The problem was that I was using RecycleView, that came from an injected fragment, inside of NestedScrollVoew. I guess they both contradict each other so that caused the slow scrolling.
recyclerViewsetNestedScrollingEnabled(false);
The above line makes recyclerview scrolling smoother in a NestedScrollView.
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/