附加一个固定的,透明的,头一个ListView? [英] Attaching a fixed, transparent, header to a ListView?
问题描述
我一直试图让这个工作有一段时间了...有没有办法把一个透明的头部固定在一个列表视图,所以它看起来有点像这样的:
I've been trying to get this working for some time... Is there any way to put a transparent fixed header on a listview, so it looks kind of like this:
当你向上滚动,头最终会与它下面第1项常规头。
As you scroll up, the header will eventually be a regular header with item 1 below it.
我想我得实现onScrollListener和做一些事情的时候第一个可见的产品列表中的第2项一样,开始用1像素移动列表视图利润率,直到它的标题下方?还是有更好的方法?在一个会怎么做这样的事情任何想法?
I guess I'll have to implement onScrollListener and do something like when the first visible item is item 2 in the list, start moving the listview margins by 1 pixel, until it is below the header? Or are there better ways? Any ideas on how one would do something like that?
推荐答案
我会作出的FrameLayout ......并首先把你的ListView它,填补了屏幕。然后把一个TextView最重要的是。以获得在顶部的希望的行为,可能有一个空白元件在列表0的位置,或者仅仅使列表项0的顶部填充有你头的高度...
I would make a FrameLayout... and put your ListView in it first, filling the screen. Then put a TextView on top of that. To get the desired behavior at the top, maybe have a blank element at position 0 of the list, or just make the top padding of list item 0 have the height of your header...
这是否有意义? ListView控件应该滚动在的FrameLayout TextView的下方。
Does that make sense? The ListView should scroll underneath the TextView in a FrameLayout.
这篇关于附加一个固定的,透明的,头一个ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!