如何创建我上面的列表视图看起来更专业? [英] How to create my above listview to look more professional?

查看:90
本文介绍了如何创建我上面的列表视图看起来更专业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我应该如何我要去创建我的列表视图看起来类似[点击这里] [1]。

Can someone tell me how should am i going to create my listview which look similar [here][1].

问题:我应该如何去满足一下的那种感觉在我的codeS里面有一个图标,文件名,文件大小却在同一时间寻找清洁,简单的每一个文件对象,如图在[这里]链接的例子[2] ??

Problem: How am i going to fulfill the sort of look and feel in my codes which has an icons, file name, and file size yet at the same time looking clean and simple on each file object as shown in the example in the link [here][2]??

能否在这个问题上的人的指导,因为我是比较新的Andr​​oid中/ java的...谢谢

Can someone guide on this matter because i'm rather new in android/java... Thanks

推荐答案

请参照下面的网址为如何实现自定义列表视图

更新

public static class VideoInfo   {
        public String name = "";
        public String size= "";
        public String path = "";//add any more variables of which you want info
    }

然后在其中创建的ArrayList即 getVideoFiles()创建该类的对象 声明的ArrayList< VideoInfo> videoItems;

then where you are creating arraylist i.e getVideoFiles() create object of this class Declare ArrayList<VideoInfo> videoItems;

private void getVideoFiles(File[] videoList) 
 {
      videoItems = new ArrayList<VideoInfo>();

      for (int i = 0; i < videolist.length; i++) 
      {
        File mfile = videoList[i];
      String path = mfile.getPath();
      path = path.substring(path.lastIndexOf("/", path.indexOf("."));
      VideoInfo model = new VideoInfo();
      model.name = path;
      model.size = mfile.length();

      videoItems.add(model);
      }

      setListAdapter(new ListViewAdapter(this, R.layout.row, videoItems));  
 }

现在的适配器通过ArrayList的这个对象以及如何在列表视图设置的变量是链接已经给出上述

now in your adapter pass this object of arraylist and how you set variables in listview is already given in link above

这篇关于如何创建我上面的列表视图看起来更专业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆