Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在谷歌+;安卓应用程序?_Android_Scroll_Google Plus - Fatal编程技术网

Android 在谷歌+;安卓应用程序?

Android 在谷歌+;安卓应用程序?,android,scroll,google-plus,Android,Scroll,Google Plus,我注意到,在玩它的时候,如果你在Google+Android应用程序的流中上下滚动,滚动条的大小会根据当前可见帖子的垂直大小而改变。例如,如果滚动到一篇长文章,则条的大小会缩小;如果滚动到一篇短文章,则条的长度会延长。这是如何实现的 现在,我并不特别需要这个功能,但它只是激发了我的好奇心。这是使用回收列表视图的副作用。当新帖子被滚动查看时,其余的项目都被虚拟化了——基本上Android猜测列表的其余部分将占用多少空间,但它实际上并没有呈现这些内容,因此无法确定。当您滚动到一篇大文章时,它假设列表

我注意到,在玩它的时候,如果你在Google+Android应用程序的流中上下滚动,滚动条的大小会根据当前可见帖子的垂直大小而改变。例如,如果滚动到一篇长文章,则条的大小会缩小;如果滚动到一篇短文章,则条的长度会延长。这是如何实现的


现在,我并不特别需要这个功能,但它只是激发了我的好奇心。

这是使用回收
列表视图的副作用。当新帖子被滚动查看时,其余的项目都被虚拟化了——基本上Android猜测列表的其余部分将占用多少空间,但它实际上并没有呈现这些内容,因此无法确定。当您滚动到一篇大文章时,它假设列表的其余部分都有大文章,因此列表较长

您可以使用以下类似的
convertView
参数获得相同的功能:

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    View view = null;
    if(convertView == null)
    {
        view = // set your view here
    }
    else
    {
        view = convertView
    }
    // set all your properties on the view here.
    return view;
}