Android blank space animation
up vote
2
down vote
favorite
I try to hide the HEADER layout when I scroll on a recyclerview. In order to hide the layout I use an animation in the "onScrolled" event :
-Show :
layout.animate().translationY(-layout.getHeight()).setInterpolator(new AccelerateInterpolator(2));
-Hide :
layout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
It's working in a way but I've still got a blank space where the HEADER was.
liste_view_layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/white"
android:orientation="vertical"
android:weightSum="1">
<!-- HEADER -->
<include layout="@layout/header_list_view" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="@layout/common_recyclerview_layout"/>
</FrameLayout>
</LinearLayout>
header_list_view :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header_list_view_layout_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:animateLayoutChanges="true"
>
<TopBarHeaderView
android:id="@+id/header_list_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/subcategory_header_section"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/header_section"/>
</FrameLayout>
</TopBarHeaderView>
</LinearLayout>
android animation
add a comment |
up vote
2
down vote
favorite
I try to hide the HEADER layout when I scroll on a recyclerview. In order to hide the layout I use an animation in the "onScrolled" event :
-Show :
layout.animate().translationY(-layout.getHeight()).setInterpolator(new AccelerateInterpolator(2));
-Hide :
layout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
It's working in a way but I've still got a blank space where the HEADER was.
liste_view_layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/white"
android:orientation="vertical"
android:weightSum="1">
<!-- HEADER -->
<include layout="@layout/header_list_view" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="@layout/common_recyclerview_layout"/>
</FrameLayout>
</LinearLayout>
header_list_view :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header_list_view_layout_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:animateLayoutChanges="true"
>
<TopBarHeaderView
android:id="@+id/header_list_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/subcategory_header_section"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/header_section"/>
</FrameLayout>
</TopBarHeaderView>
</LinearLayout>
android animation
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I try to hide the HEADER layout when I scroll on a recyclerview. In order to hide the layout I use an animation in the "onScrolled" event :
-Show :
layout.animate().translationY(-layout.getHeight()).setInterpolator(new AccelerateInterpolator(2));
-Hide :
layout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
It's working in a way but I've still got a blank space where the HEADER was.
liste_view_layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/white"
android:orientation="vertical"
android:weightSum="1">
<!-- HEADER -->
<include layout="@layout/header_list_view" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="@layout/common_recyclerview_layout"/>
</FrameLayout>
</LinearLayout>
header_list_view :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header_list_view_layout_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:animateLayoutChanges="true"
>
<TopBarHeaderView
android:id="@+id/header_list_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/subcategory_header_section"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/header_section"/>
</FrameLayout>
</TopBarHeaderView>
</LinearLayout>
android animation
I try to hide the HEADER layout when I scroll on a recyclerview. In order to hide the layout I use an animation in the "onScrolled" event :
-Show :
layout.animate().translationY(-layout.getHeight()).setInterpolator(new AccelerateInterpolator(2));
-Hide :
layout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
It's working in a way but I've still got a blank space where the HEADER was.
liste_view_layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/white"
android:orientation="vertical"
android:weightSum="1">
<!-- HEADER -->
<include layout="@layout/header_list_view" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="@layout/common_recyclerview_layout"/>
</FrameLayout>
</LinearLayout>
header_list_view :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header_list_view_layout_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:animateLayoutChanges="true"
>
<TopBarHeaderView
android:id="@+id/header_list_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/subcategory_header_section"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/header_section"/>
</FrameLayout>
</TopBarHeaderView>
</LinearLayout>
android animation
android animation
asked Nov 8 at 9:45
QuentinV
8912
8912
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Animations changes the way the view is drawn, but its true location still remains the same. So while it looks like the header moved or was hidden, it's still technically there.
To solve this you can either:
Set animation.setFillAfter(true);
or
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//set view visibility to `GONE`
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Animations changes the way the view is drawn, but its true location still remains the same. So while it looks like the header moved or was hidden, it's still technically there.
To solve this you can either:
Set animation.setFillAfter(true);
or
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//set view visibility to `GONE`
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
add a comment |
up vote
1
down vote
Animations changes the way the view is drawn, but its true location still remains the same. So while it looks like the header moved or was hidden, it's still technically there.
To solve this you can either:
Set animation.setFillAfter(true);
or
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//set view visibility to `GONE`
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
add a comment |
up vote
1
down vote
up vote
1
down vote
Animations changes the way the view is drawn, but its true location still remains the same. So while it looks like the header moved or was hidden, it's still technically there.
To solve this you can either:
Set animation.setFillAfter(true);
or
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//set view visibility to `GONE`
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
Animations changes the way the view is drawn, but its true location still remains the same. So while it looks like the header moved or was hidden, it's still technically there.
To solve this you can either:
Set animation.setFillAfter(true);
or
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//set view visibility to `GONE`
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
answered Nov 8 at 9:52
Ezzy
6122621
6122621
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
add a comment |
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
When the animation is played, the Header container does not follow the content. The container keeps the same height rather than progressively decreasing it.
– QuentinV
Nov 8 at 10:19
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
Maybe have another animation playing for the container also?
– Ezzy
Nov 8 at 10:23
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
I use the following layout for the animation : header_list_view with ID : header_list_view_layout_container. I playing the animation on the container
– QuentinV
Nov 8 at 10:34
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205091%2fandroid-blank-space-animation%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password