Customized ListView with TextView, TextView, RadioGroup in Android

前端 未结 2 877
悲&欢浪女
悲&欢浪女 2021-01-21 22:13

I\'m developing an application with ListView for Student Marklist creation.

In this application, the List have 10 students. There are four grades provided f

2条回答
  •  春和景丽
    2021-01-21 22:45

    This is a sample example of custom adapter for listview. Modify it as your need: XML layout :

    
    
        
    
        
    
            
    
            
    
        
    
        
    
        
    
            
    
            
    
        
    
    

    news.java :

    List> fillMaps = new ArrayList>();
    String[] from = new String[] {"details", "date"};
    int[] to = new int[] { R.id.item1, R.id.item2};
    ListView lv= (ListView)findViewById(R.id.listview);
    HashMap map = new HashMap();
    map.put("details", "This is a sample message");
    map.put("date", "24-07-2003");
    fillMaps.add(map);
    
    SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.grid_item, from, to);
    lv.setAdapter(adapter);
    

提交回复
热议问题