ListView之SimpleAdapter列表(复杂…

Listview+SimpleAdapter+网页跳转实现步骤 Listview+SimpleAdapter+网页跳转具体实现步骤,将对应代码复制至对应布局文件和功能文件即可使用 立即下载
ListView之SimpleAdapter列表(复杂显示)

新建datalist.xml文件
<LinearLayout 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="horizontal"
    tools:context=".MainActivity"
    android:id="@+id/datalist">
    
        <ImageView 
         android:id="@+id/pic"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="left"
         android:src="@drawable/pic_oracle"/>
        
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="180px"
       android:layout_height="wrap_content"
       android:orientation="vertical"
       tools:context=".MainActivity"
       android:gravity="left">
  
  
    <TextView 
       android:id="@+id/company"
       android:textSize="16px"
       android:padding="3px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"/>
  
    <TextView 
       android:id="@+id/ceo"
       android:padding="3px"
       android:textSize="10px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"/>   
</LinearLayout>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="200px"
       android:layout_height="wrap_content"
       android:orientation="vertical"
       tools:context=".MainActivity"
       android:gravity="left">
  
  
    <TextView 
       android:id="@+id/type"
       android:textSize="16px"
       android:padding="1px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"/>
  
    <ImageView 
       android:id="@+id/score"
       android:padding="1px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"/>  
    
</LinearLayout>
</LinearLayout>

main.xml

<LinearLayout 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"
    tools:context=".MainActivity" >

    <ListView 
        android:id="@+id/datalist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

</LinearLayout>

.java文件
public class MainActivity extends Activity {

//定义我们的图片数组
private int pic[]=new int[]
{
R.drawable.pic_oracle,
R.drawable.pic_javase,
R.drawable.pic_javaweb,
R.drawable.pic_javaee,
R.drawable.pic_android,
R.drawable.pic_game
};
//定义我们显示的公司、CEO、公司类型、公司的星级图片
private String data[][]=new String[][]
{
{"百度","李彦宏","搜索",R.drawable.start_01+""},
{"阿里巴巴","马云","电子商务",R.drawable.start_02+""},
{"腾讯","马化腾","社交网络",R.drawable.start_03+""},
{"新浪","曹国伟","社交媒体",R.drawable.start_04+""},
{"网易","丁磊","互联网",R.drawable.start_05+""},
{"搜狐","张朝阳","互联网",R.drawable.start_01+""},
};
private ListView dataList=null;
private List<Map<String,String>> list=new ArrayList<Map<String,String>>();
private SimpleAdapter simpleAdapter=null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.dataList=(ListView) super.findViewById(R.id.datalist);
//将我们每一条记录添加到我们的Map当中
for(int i=0;i<data.length;i++){
//定义我们的Map数据
Map<String,String> map=new HashMap<String, String>();
//添加数据
map.put("pic", String.valueOf(pic[i]));
map.put("company",data[i][0]);
map.put("ceo", data[i][1]);
map.put("type", data[i][2]);
map.put("score", data[i][3]);
this.list.add(map);
}
this.simpleAdapter=new SimpleAdapter(
this, 
this.list, 
R.layout.datalist, 
new String[]{"pic","company","ceo","type","score"}, 
new int[]{R.id.pic,R.id.company,R.id.ceo,R.id.type,R.id.score}
);
this.dataList.setAdapter(this.simpleAdapter);
}
}

那些复杂的列表总要弄个清楚——(二)用SimpleAdapter做适配器 原创博客中“那些复杂的列表总要弄个清楚——(二)用SimpleAdapter做适配器 ”的代码 立即下载

相关推荐

mpu6050原理图_STM32控制 MPU6050 六轴陀螺仪资料汇总

一般使用MPU6050的步骤是先驱动I2C总线,然后初始化MPU6050,从MPU6050读取数据,最后是数据的处理。本文档详细介绍有关MPU6050 三维角度传感器电子陀螺仪使用说明。附件内容提供该 MPU6050模块原理图,配套STM32代码,相关数据手册及参考文档。实物连接图:MPU6050 六轴陀螺仪特点:使用芯片:MPU-6050供电电源:3-5v(内部低压差稳压)通信方式:标...

weixin_39911056的博客 4758

11-界面控件ListView之使用SimpleAdapter实现复杂的界面显示

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Lis

高调做事,低调做人! 1424

基于Python的手语识别项目(简单版)

总之,看似简单的代码,实则花费了我不少的时间和精力,我曾无数次在深夜的灯光下,与代码为伴,只为了一点点优化,一丝丝提升。让我们一起,以尊重原创的精神,推动编程领域的发展,让这份热爱和技术的力量,照亮更多人的前行之路。模型的建立(---------------本人采用的是开源的asl-alphabet手势识别库,记得放在路径下--------------)current_dir需要根据自己的路径修改!current_dir需要根据自己的路径修改!current_dir需要根据自己的路径修改!

lusen_j的博客 1966

Adnroid开发中ListView使用SimpleAdapter显示复杂列表的问题

学习Android的同学注意了!!!学习过程中遇到什么问题或者想获取学习资源的话,欢迎加入Android学习交流群,群号码:364595326 我们一起学Android!importjava.util.ArrayList;import java.util.HashMap;import java.util.List;importjava.util.Map;importa...

weixin_34219944的博客 145

基于IMX429-IMX430-IMX432-IMX437系列传感器的SLVS-MIPI桥接方案设计与实现

本文详细介绍了针对索尼IMX429、IMX430、IMX432及IMX437系列传感器的SLVS-MIPI桥接方案设计与实现。针对工业视觉、车载摄像头等应用中主流SoC仅支持MIPI接口的痛点,提出基于FPGA(如Lattice Crosslink-NX)的透传桥接方案,将传感器输出的SLVS信号无损转换为MIPI CSI-2信号,确保数据完整性与低延迟,并探讨了硬件选型、逻辑设计及多传感器兼容性等关键问题。

weixin_29230901的博客 460

避开ego_planner仿真的第一个坑:深度相机、点云与odom话题配置全指南

本文详细解析了ego_planner仿真中深度相机、点云与odom话题配置的关键问题,帮助开发者避开常见陷阱。从数据流架构到具体配置细节,包括深度相机的内外参匹配、点云数据规范要求以及odom话题的验证方法,提供了全面的实战指南和优化建议。

weixin_30335575的博客 492

android simpleadapter 动态模板,Adnroid开发中ListView使用SimpleAdapter显示复杂列表的问题...

学习Android的同学注意了!!!学习过程中遇到什么问题或者想获取学习资源的话,欢迎加入Android学习交流群,群号码:364595326 我们一起学Android!importjava.util.ArrayList;import java.util.HashMap;import java.util.List;importjava.util.Map;importandroid.app....

weixin_31225063的博客 138

软考备考:《系统规划与管理师教程》(第2版)第2章——数字ZG与数智化发展

🔴数字化转型的定义:数字化转型是建立在数字化转换、数字化升级基础上,进一步触及组织核心业务,以新建一种业务模式为目标的高层次转型。

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 960

android listview复杂布局,具有复杂数据和每行复杂布局的复杂ListView示例?

我从数据库调用中提取产品对象列表,并且我希望使用非滚动页眉和页脚在我的活动中构建数据的ListView。 每行包含一个产品缩略图,一些数据和一个水平排列的按钮。 我知道使用ListView我可以使用单独的布局来扩充每一行。我见过的大多数使用ListView的例子只显示了一个简单的字符串数组,它填充了活动的整个视图,但是大多数现实世界的例子都会更复杂,我找不到任何好的例子来解释所有这些部分是如何适合...

weixin_35711352的博客 356

微信小程序 - {“errMsg”:”requestPayment:fail banned”} 微信小程序调用wx.requestPayment支付失败返回错误(uniapp微信小程序微信支付报错)

{“errMsg”:”requestPayment:fail banned”},微信小程序调用wx.requestPayment报错requestPayment:fail banned,uni-app微信小程序wx.requestPayment支付报错requestPayment:fail banned,拉起小程序支付报错,iPhone苹果ios真机微信支付报错,Android安卓手机微信支付报错,支付报错,商户配置,签名验证,uniapp 小程序支付微信支付一场,设置过b2b类目,确认了商户号相关功能正常

🏆 前端领域优质创作者 3340

ACS运动控制器编程语言

ACS运动控制器采用SPiiPlusLanguage(SPL)作为核心编程语言,该语言基于C语法设计,内置丰富的运动控制指令,支持点位运动、插补等复杂控制。控制器提供专用开发工具SPiiPlusManager和ACSStudio,支持图形化编程与调试。同时兼容TCP/IP、EtherCAT等多种扩展接口,便于与上位机或PLC集成。使用时需注意实时性优先级、轴参数匹配等关键事项。官方文档和示例程序为开发者提供了完善的学习资源。

StevenChen的博客 616

Android 入门列子 (五) ListView显示信息列表

实现效果如图 使用ListView显示信息列表 1.理解ListView的基础使用 ListView.作用:Android系统中显示列表的控件 2.两种适配器 ArrayAdapter SimpleAdapter (1).数据适配器 作用:把复杂的数据(数组,链表,数据库,集合等)填充在指定视图界面上,是连接数据源和视图界面的桥梁。 (2).ArrayAdapter(数组适配器):用于绑定格式单一的数据 数据源:可以是集合或数组 (...

学英语的程序员 1172

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

ListView最基本的使用方法SimpleAdapter(二)

Android, ListView, SimpleAdapter

小孟飞飞的博客 654

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

列表视图(ListView)——SimpleAdapter

通过ArrayAdapter实现Adapter虽然简单、易用,但ArrayAdapter的功能比较有限,它的每个列表项只能是TextView。如果开发者需要实现更多复杂的列表项,则可以考虑使用SimpleAdapter.不要被SimpleAdapter的名字欺骗了,SimpleAdapter并不简单,而且它的功能非常强大。ListView的大部分应用场景,都可以通过SimpleAdapter来提供列

跟着大数据和AI去旅行 1010

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Android 中ArrayAdapter,SimpleAdapter,BaseAdapter三种适配器的使用

ListView中使用ArrayAdapter,SimpleAdapter,BaseAdapter这三种适配器

qq_23939265的博客 2217

使用SimpleAdapter创建ListView

使用SimpleAdapter创建ListView 通过ArrayAdapter实现的Adapter虽然简单、易用,但功能有限,它只能通过每个列表项是TextView,如果需要实现更复杂的列表项,则可以使用SimpleAdapter。 SimpleAdapter并非如名字简单,它的功能非常强大,可实现ListView的大部分应用。 使用如下: <RelativeLayout xmlns

萧萧北keno的专栏 1298

ListView三种适配器介绍ArrayListAdapter,SimpleAdapter,BaseAdapter

ListView 组件作用:使用ListView组件 绘制出漂亮的列表Adapter适配器 只有通过Adapter才可以把列表中的数据映射到ListView中 在android的开发中最Adapter 一共可以分为 ArrayAdapter,BaseAdapter,CursorAdapter,HeaderViewListAdapter, ResourceCursorAdapter,SimpleA

zhj19940809的专栏 1万+

Android零基础入门第41节:使用SimpleAdapter

通过ArrayAdapter实现Adapter虽然简单、易用,但功能有限,如果需要实现更复杂的列表项,则可以考虑使用 SimpleAdapter。

鑫鱻的博客 1389

Android 中关于SimpleAdapter的一些见解

首先SimpleAdapter是一个Adapter的一个实现类,关于Adapter,大家可以理解为是一个接口。Adapter派生的两个主要的子接口就是 ListAdapter 和 SpinnerAdapter 。 这里不聊其他的。 关于SimpleAdapter 这玩意是 **并不简单、功能强大,可用于将List集合的多个对象包装成多个列表项。** 当然这个说法是官方的哈。

再见孙悟空 562

Adapter系列之SimpleAdapter

Adapter系列之SimpleAdapter通过ArrayAdapter实现的Adapter虽然很简单、易用,但ArrayAdapter的功能比较有限。它的每个列表项只能是TextView,所以下面,笔者将介绍一种可以实现更复杂的列表项——SimpleAdapter.1 .activity_main.xml文件<LinearLayout xmlns:android="http://schemas

It一zhai男 431

【 ListView --- ArrayAdapter】

ListView 简单列表——ArrayAdapter 图文列表——SimpleAdapter 图文复杂列表——BaseAdapter 1 适配器、连接器 Adapter 2 ArrayAdapter activity_array_list.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" .

mango660的博客 455

android listview组件之ArrayAdapter,SimpleAdapter

ListView 是android开发中最常用的组件之一,它通过一个adapter来构建显示通常有三种adapter可以使用ArrayAdapter ,SimpleAdapter,CursorAdapter。CursorAdapter主要正对数据库使用,下面通过例子介绍ArrayAdapter ,SimpleAdapter的简单使用: 1:ArrayAdapter 它接受一个数组或者...

abc20899的专栏 117
上一篇: String.valueOf()&nbsp;方法的使用
下一篇: jsMath.floor是什么
普通网友
博客等级 码龄16年 90粉丝 1232原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值