如何在android中的listview中添加标题,使其与listview中的元素水平移动?
我的问题是,如何将标题添加到列表视图中,该列表视图在垂直方向上是静态的,但在水平方向上它可以随列表视图中的项目一起移动。 例如,我在列表视图中有 8 列,我使用自定义适配器扩展 Baseadapter 来扩展视图,现在每列都有标题。 所以我想要列表视图中的每个标题。现在假设我水平移动列表标题也应该移动。如果我垂直滚动,则标题不应垂直移动,它应坚持其位置。我尝试过 addHeaderView 但我的标题也垂直移动。 你可以想象“microsoft excel”是如何工作的,如果你垂直滚动,你会得到数千行带有静态标题的行,但如果你水平移动,标题也会随着列移动。
My query is that how can i add Header to the listview which will be static vertically but horizontally it can move with the items in the listview.
for e.g. say i have 8 columns in listview i have used custom adapter extends Baseadapter to inflate the view now each column has header.
so i want this each header in listview. now suppose i move the list horizontally header also should move. and if i scroll vertically then header should not move vertically it should stick to its position. i have tried addHeaderView but my header moves vertical also.
you can think of how "microsoft excel" works if you scroll vertically than you will get thounds of rows whith static header but if you move horizontally the header also move along with the columns.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过 listView.addHeaderView()
addHeaderView 已在developer.android.com上提供。
已经有很多其他类似的问题了,看看how-to-use-android-addheaderview 如果您需要额外的信息,这可能对您有用信息
请使用搜索功能寻找更多答案
Did you try listView.addHeaderView()
The documentation for addHeaderView is available on developer.android.com
There are already a lot of other questions like this on, look at how-to-use-android-addheaderview which may also be useful to you if you need additional information
Please use the search facility to look for more answers