How to create my above listview to look more professional?

前端 未结 5 689
醉酒成梦
醉酒成梦 2020-12-12 07:43

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

Problem: How am i going to fulfill the sort of look and feel in my cod

5条回答
  •  北海茫月
    2020-12-12 07:58

    Refer to following url for how to implement custom listview

    Update

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

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

    private void getVideoFiles(File[] videoList) 
     {
          videoItems = new ArrayList();
    
          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));  
     }
    

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

提交回复
热议问题