main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
</RelativeLayout>

su.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp" android:orientation="horizontal">
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="5dp"
android:layout_marginLeft="8dp" />
<LinearLayout
android:layout_toRightOf="@+id/img"
android:layout_width="match_parent"
android:layout_height="60dp" android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp" android:textSize="16sp"
/>
<TextView
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp" android:textSize="10sp"/> </LinearLayout> </LinearLayout>

MainActivity.java:

public class MainActivity extends Activity {
private ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv = (ListView)findViewById(R.id.listview);
SimpleAdapter adapter = new SimpleAdapter(this,getData(),
R.layout.su,
new String[] {"img","title","info"},
new int[] {R.id.img,R.id.title,R.id.info});
lv.setAdapter(adapter);
} private List<Map<String,Object>> getData(){
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> map = new HashMap<String,Object>();
map.put("img",R.drawable.s1802);
map.put("title","Smith");
map.put("info", "电台DJ");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1804);
map.put("title","西施");
map.put("info", "四大美女之一");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1805);
map.put("title","大圣归来");
map.put("info", "国产电影");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1809);
map.put("title","旗木卡卡西");
map.put("info", "copy忍者");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1810);
map.put("title","飞雷神之术");
map.put("info", "来无影去无踪");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1811);
map.put("title","HelloKitty");
map.put("info", "女生的最爱");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1816);
map.put("title","机械暴龙兽");
map.put("info", "亚古兽的完全体");
list.add(map); map = new HashMap<String,Object>();
map.put("img",R.drawable.s1811);
map.put("title","HelloKitty");
map.put("info", "女生的最爱");
list.add(map); return list;
}
}

图文列表,关于Simpleadapter的更多相关文章

  1. NEC学习 ---- 模块 - 上图下文图文列表

    上图下文图文列表的效果如下图: 可以看到三个红色框中的三中"上图下文的图文列表"; 这里的代码其实没什么问题, 对于这种布局, 其实可以参考我上一篇介绍: NEC学习 ---- 模 ...

  2. [转]ionic3项目实战教程三(创建provider、http请求、图文列表、滑动列表)

    本文转自:https://blog.csdn.net/lyt_angularjs/article/details/81145468 版权声明:本文为博主原创文章,转载请注明出处.谢谢! https:/ ...

  3. python 全栈开发,Day126(创业故事,软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON)

    作业讲解 下载代码: HBuilder APP和flask后端登录 链接:https://pan.baidu.com/s/1eBwd1sVXTNLdHwKRM2-ytg 密码:4pcw 如何打开APP ...

  4. 软件部需求,内容采集,显示内容图文列表,MongoDB数据导入导出JSON

    全局变量 由于多个html页面,需要引用同一个变量.这个时候,需要定义一个全局变量!如何定义呢? 默认包含了mui的html文件都导入mui.js文件.那么将变量写在mui.js中,就可以实现所有页面 ...

  5. Vue(小案例_vue+axios仿手机app)_图文列表实现

    一.前言 1.导航滑动实现   2.渲染列表信息时让一开始加载的时候就请求数据 3.根据路由的改变,加载图文的改变(实现用户访问网站时可能执行的三个操作) 二.主要内容 1.导航滑动实现: (1)演示 ...

  6. NEC学习 ---- 模块 - 左图右文图文列表

    该模块效果图: 这个模块也是在开发中经常使用的一种: HTML代码: <div class="container"> <div class="m-lis ...

  7. Jquery滚动到页面底部自动Ajax加载图文列表,类似图片懒加载效果,带加载效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. Discuz 首页图文列表实现

    <div id="shoucang"> <!--{eval $list_count=0;}--> <!--{loop $threadlist $thr ...

  9. jQuery+ajax实现滚动到页面底部自动加载图文列表效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. JS实现选择菜单栏(配合慕课网淘宝搜索框的课程)

    以下是关于实现慕课网淘宝搜索框的JS代码,不过只有选择菜单栏(其余比较容易实现). <!doctype html> <html> <head> <!--在IE ...

  2. CSS 简单归纳 -- 前端知识

    CSS:cascading style sheets层叠样式表,用于美化页面 css的三种表现形式:1.行内样式(内嵌样式):结构的内部,即写在标签内的样式:写在标签的开始部分内部,style属性当中 ...

  3. JavaScript 事件处理机制

    DOM 事件流 DOM 是一个树型结构,当一个HTML元素产生一个事件时,该事件会在该元素结点与根节点之间按特定的顺序传播,路径所经过的节点都会收到该事件,这个传播过程可称为DOM事件流.而事件传播的 ...

  4. event.stopPropagation与event.preventDefault的区别

    1.event.stopPropagation 停止事件的传播,阻止它被分配到其它Dom节点.但是不能阻止同一Dom节点上的其它事件句柄被调用. 注:不同Dom节点的事件必须是一致的.如父节点和子节点 ...

  5. Java 社区平台 - Sym 1.7.0 发布

    English | 中文 简介 Symphony([ˈsɪmfəni],n.交响乐)是一个现代化的社区平台,因为它: 实现了面向内容讨论的论坛 包含了面向用户分享.交友.游戏的社交网络 集成了聚合独立 ...

  6. MAYA逼真手枪制作视频教程 中文字幕

    下载地址 更多中文字幕教程请关注微镜映画网,有各类CG教程提供

  7. HTIML5 真的打败了Flash?新测试结果出人意料

    [编者按]本文最早发布于 2010 年,通过 Flash 与 HTML5 在 Mac 及 Windows 平台不同浏览器中的测试表现,比较两者的性能并分析背后的原因.虽然是一篇老文,但其客观冷静的分析 ...

  8. ASP.NET Core Razor生成Html静态文件

    一.前言 最近做项目的时候,使用Util进行开发,使用Razor写前端页面.初次使用感觉还是不大习惯,之前都是前后端分离的方式开发的,但是使用Util封装后的Angular后,感觉开发效率还是杠杠滴. ...

  9. Cordova 8 架构使用sqlite - 谢厂节的博客 - 博客频道 - CSDN.NET - Google Chrome

    Cordova 8 架构使用sqlite 标签: androidcordova 2015-07-16 16:41 4302人阅读 评论(0) 收藏 举报  分类: IONIC/Cordova(18)  ...

  10. Windows2003系统如何设置能让两个人共用一个桌面同时远程控制?

    在windows 2003上,可以两人同时同一桌面控制一台服务器,交流非常方便. 解决方案: 两人都用终端远程登陆到服务器上,其中一人在“开始”--“管理工具”--“终端服务管理器”,选中对方的用户名 ...