向外推/拉的动作条在ListView中滚动向外、动作、ListView

由网友(再平凡咱也是限量版)分享简介:谷歌最新的报亭应用,设有一个动作条和 ViewPager 标签栏慢慢地简化了屏幕的上方当它下面的列表向下滚动。 重要的是,它简化了以相同的速度列表滚动。当列表向上滚动的动作条减轻背部到屏幕上,再次以相同的速度列表滚动 The latest Google Newsstand App features an Action...

谷歌最新的报亭应用,设有一个动作条 ViewPager 标签栏慢慢地简化了屏幕的上方当它下面的列表向下滚动。 重要的是,它简化了以相同的速度列表滚动。当列表向上滚动的动作条减轻背部到屏幕上,再次以相同的速度列表滚动

The latest Google Newsstand App features an ActionBar and ViewPager tab bar which slowly eases out the top of the screen when the list below it is scrolled down. Importantly, it eases out at the same speed the list is scrolled. When the list is scrolled upwards the ActionBar eases back onto the screen, again at the same speed the list is scrolled.

我不是指动作条 隐藏()节目()方法,而不是我想知道如何隐藏和显示的动作条以同样的速度在它下面的列表中滚动。的

I am not referring to the ActionBar hide() and show() methods, instead I want to know how to hide and show the ActionBar at the same rate the list below it is scrolled.

这是如何实现的?所有试图在寻找文件的解决方案已被证明不成功的,因此任何帮助将是AP preciated。

How is this achieved? All attempts at finding a documented solution have proven unsuccessful so any help would be appreciated.

推荐答案

创建片段子类,它充当一个动作条代替。请使用OnScrollListener更新片段的视图的 translationY 滚动事件后。

Short Answer

Create a Fragment subclass that serves as an ActionBar replacement. Use an OnScrollListener to update the fragment's view's translationY after scroll events.

周围挖的动作条源$ C ​​$ C后,似乎没有公共的方法来访问的ActionBar容器视图。但是,在有遗嘱,有一种方法。

After digging around the ActionBar source code, it seems that there is no public method for accessing the ActionBar container view. But where there's a will, there's a way.

您可以使用下面的抢参考操作栏的看法:

You can grab a reference to the Action Bar's view using the following:

int resId = getResources().getIdentifier("action_bar_container", "id", "android");
View actionBarContainer = findViewById(resId);

免责声明: action_bar_container 是一个私人的ID,所以它是受到谷歌的念头。使用您自己的风险。

Disclaimer: action_bar_container is a private ID, so it's subject to Google's whims. Use at your own risk.

一旦你的操作栏的看法,你可以激活它,但是你会喜欢的。

Once you have the Action Bar's view, you can animate it however you'd like.

我砍死在一起一个半功能例如的,如果你有兴趣。

I hacked together a semi-functional example if you're interested.

希望这有助于!

阅读全文

相关推荐

最新文章