Android 中滚动可选择文件的文件列表
我是 Android 开发的初学者,正在开始我的第二个 Android 项目 - 一个基于网络的文件共享应用程序。我想在屏幕上显示从网络资源获取的文件列表,用户可以在屏幕上滚动文件并选择多个文件。每个文件信息都会有较大点大小的文件名,后面是小点大小的文件大小和源信息。我希望该列表与您按选项>时出现的列表完全相同。在Root Explorer Android 应用程序中进行多项选择。任何输入,我如何布局用户界面,都将受到高度赞赏。 稍微搜索了一下发现这是一个经常使用的模式 http://www.androidpatterns.com/uap_pattern/slide-to-scroll
但作为 Android 开发(广义上的 UI 开发)的初学者,我无法布置我的 UI。我尝试将 ScrollView 作为垂直方向 LinearLayout 的父级,其中包含多个 TextView,但这似乎不是我所需要的。
更新:是的,我还想在底部放置一些按钮,例如“下载”、“查看信息”,就像放置在根资源管理器中一样
I am a beginner in Android development and starting my second Android project - a network based file sharing application. I want to show a list of files, that I'll fetch from a network resource, on the screen in which the user can scroll through the files and select multiple files. Each file information will have the filename in larger point size followed by filesize and source info in the next line in small point size. I want the list exactly like the list which appears when you press Options > Multi-select in Root Explorer android application. Any inputs, how may I go about laying out the user interface, will be highly appreciated.
A bit of search revealed that it is a frequently used pattern
http://www.androidpatterns.com/uap_pattern/slide-to-scroll
but being a beginner in Android Development(UI development broadly) I am unable to lay out my UI. I tried ScrollView as a parent of vertically oriented LinearLayout with several TextViews inside but that doesn't seem to be what I need.
Update:And yeah, I also want to place some buttons like Download, View information in the bottom just like they are placed in Root Explorer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个带有自定义适配器的
ListView
。您可以在 Internet 上找到的这个示例提供了您想要在 Root Explorer 中实现的精确行为。
不同之处在于,在该示例
扩展 ArrayAdapter
的情况下,您需要将TextView
文本大小设置为更小或更大,具体取决于您的需要。如果您需要的话我可以澄清。但我认为,如果您点击我提供给您的链接,您将不需要更多。
开始尝试,一旦你有了感觉,你就会发现这很容易。
*编辑:哎呀,我忘了链接。 这里。
You need a
ListView
with a custom adapter.This example that you can find on the Internet provides an exact behavior of what you want to achieve as in Root Explorer.
The difference is that where that example
extends ArrayAdapter
, you would need to set theTextView
text size to something smaller or bigger, depending on what you need.I can clarify if you need. But I don't think you'll need more than that if you follow the link I gave to you.
Start experimenting and you'll see that it's quite easy once you get the feeling.
*edit: oops, I forgot the link. Here it is.