简体   繁体   English

Android 中的自定义列表视图,顶部有图像

[英]Custom listview in Android with an image at top

I have an Android project that displays results, using a simple listview.我有一个 Android 项目,它使用简单的列表视图显示结果。 What I need is to display an image at the top of listview as follows:我需要的是在列表视图的顶部显示图像,如下所示:

滚动前

滚动后

Please note, the image on top, should be scrollable.请注意,顶部的图像应该是可滚动的。 Would you please help me.你能帮帮我吗Thanks.谢谢。

Use ListView.addHeaderView() to add a header view to the top of your ListView.使用ListView.addHeaderView()将 header 视图添加到 ListView 的顶部。

List view has header and footer options.列表视图有 header 和页脚选项。 You can put your scrollable image view in one XML layout, inflate and use that as list view header.您可以将可滚动图像视图放在一个 XML 布局中,展开并将其用作列表视图 header。

You can get more info if you search for list view header. The quickest one I can get is如果您搜索列表视图 header,您可以获得更多信息。我能得到的最快的是

Android listview with header and footer buttons Android 带有 header 和页脚按钮的列表视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM