• ListView


    package com.hanqi.testapp2;
    
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.widget.ListView;
    import android.widget.SimpleAdapter;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    public class TestActivity7 extends AppCompatActivity {
              ListView lv_2;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_test7);
            lv_2=(ListView)findViewById(R.id.lv_2);
            List<Map<String,Object>> lm=new ArrayList<Map<String, Object>>();
            Map<String,Object> map = new HashMap<String,Object>();
            map.put("p7",R.drawable.p7);
            map.put("name","美食1");
            map.put("content", "美食1的介绍");
            lm.add(map);
    
             map = new HashMap<String,Object>();
            map.put("p7",R.drawable.p7);
            map.put("name","美食2");
            map.put("content", "美食2的介绍");
            lm.add(map);
            String str[]={"p7","name","content"};
            int []ids={R.id.lv_3,R.id.tv_7,R.id.tv_8};
    
    
    
            SimpleAdapter simpleAdapter=new SimpleAdapter(this,lm,R.layout.simple_adapter,str,ids);
    
           lv_2.setAdapter(simpleAdapter);
    
        }
    
    }
    

      

  • 相关阅读:
    JAVA 动态代理
    IDEA 配置阿里云Maven
    JAVA Spring5静态代理
    Spring5 常用注解
    react
    Angular
    微信小程序
    H5
    vue-ui
    jQuery
  • 原文地址:https://www.cnblogs.com/lizhe313/p/5504342.html
Copyright © 2020-2023  润新知