如何创建我上面的列表视图看起来更专业?视图、列表、专业

由网友(水能煮粥〃亦能洗碗)分享简介:有人可以告诉我应该如何我要去创建我的列表视图看起来类似[点击这里] [1]。 Can someone tell me how should am i going to create my listview which look similar [here][1]. 问题:我应该如何去满足一下的那种感觉在我的code...

有人可以告诉我应该如何我要去创建我的列表视图看起来类似[点击这里] [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

阅读全文

相关推荐

最新文章