ScrollView: How to detect if certain View inside ScrollView is past scrolling? - android

I have ScrollView and inside this ScrollView are some independent Views. What I want to achieve is if View A touches top of ScrollView, it will start animating - transforming instead of hiding out of ScrollView (visible screen).
It should have "collapse" effect but not completely collapsed. This View A is not toolbar or action bar so I cant use CollapsingToolbarLayout
I want to achieve "paralax" effect on custom View instead of ToolBar. With certain child views inside this View should animate/shuffle/hide as I scroll. I cant find any native solution to this only default Toolbar.

Related

BottomSheet click fires through

I have a BottomSheet with some non-clickable content. This BottomSheet is sliding over a RecyclerView.
Problem is when I tap on the BottomSheet, the RecyclerView item behind it fires (which of course shouldn't happen). The list also scrolls when scrolling on the BottomSheet.
I've tried to set android:clickable=false on the container of the BottomSheet with no effect.
Is there an obvious trick for preventing that?
You need to set android:clickable=true on the container of the BottomSheet instead of android:clickable=false.

Coordinator Layout - unwanted animation on layout shrink

In my application i have CoordinatorLayout with nested custom view, which has custom MoveUpwardBehavior. When Snackbar appears, I want this view to be pushed over it and it works.
The problem is, that CoordinatorLayout is nested in RelativeLayout which has flag animateLayoutChanges=true. When RelativeLayout animates its views, CoordinatorLayout shrinks a bit (vertically). It causes, that mentioned custom view also moves, but i want to make it stick to its position. Any thoughts, how I can accomplish it?
You need to set CoordinatorLayout to be top-level layout instead of wrapping it inside another parent. The animation and displacement of the views during layout animation is totally normal. You may want to tweak your MoveUpwardBehavior to get the target view to keep the intended behavior, in case that your custom view is not direct descendant of CoordinatorLayout.

Image Zoom In and Out with Recycler View Android

I am trying to implement a Recycler View in which the first item covers at-least half of the screen. This item has an image set as a background.
The behavior that i want to achieve is: when user scrolls upward the recycler view, the image should zoom in, and when user scrolls it downward, the image should zoom out and should be in original dimension as soon as the first item is completely visible.
I have tried using setScale() property on imageView but it's not working as expected. Please help!
Keep the first item in CollapsingToolbarLayout instead of placing it in RecyclerView and wrap both the views in CoordinatorLayout.
Then in CollapsingToolbarLayout add parallax effect using attribute collapseMode="parallax"
Finally, bound the RecyclerView scroll behavior to CollapsingToolbarLayout using property layout_behavior="#string/appbar_scrolling_view_behavior".

Parallax effect for a footer in android

Is there a way to implement footer parallax effect in Android? I know it's possible to implement header parallax with CoordinatorLayout + AppBarLayout. I wonder if it's possible to make a scroll animation of footer view like here https://codepen.io/hudsonmarinho/pen/FHGeK
I implemented that by adding a fake transparent element in the adapter of RecyclerView. The height of the fake element should be equal to the footer height. The footer view should be placed above RecyclerView in a FrameLayout

Hiding Toolbar Android when scrolling down but not All Layout views

I have an Android Layout with a Scroll View Layout as Root, with a Relative Layout.
Inside of this Relative Layout I have a Toolbar and a Text View and other children below.
How can I change this layout when scrolling down, the toolbar can hide and other children inside Scroll View as well, but not this specific Text View?
ScrollView
Relative Layout
Toolbar
TextView (Visible even in Scrolling Down)
Other Children...

Categories

Resources