效果:

布局代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_environment"
tools:context=".QueryShopping"> <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:src="@drawable/btn_inventory_select" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@id/imageView1"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
android:layout_toRightOf="@id/imageView1"
android:background="@drawable/bg_frame_descend_setting"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="10dip" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" > <TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="订单号:"
android:textColor="@color/white" /> <EditText
android:id="@+id/editText1"
android:layout_width="80dp"
android:layout_height="24dip"
android:background="@drawable/input"
android:padding="2dp"
android:singleLine="false"
android:textColor="@color/white" > <requestFocus />
</EditText> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="起始时间:"
android:textColor="#ffffff" /> <Button
android:id="@+id/btnStartTime"
android:layout_width="100dip"
android:layout_height="24dip"
android:background="@drawable/input"
android:gravity="center"
android:text="2015-08-01"
android:textColor="#ffffff" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="结束时间:"
android:textColor="#ffffff" /> <Button
android:id="@+id/btnEndTime"
android:layout_width="100dip"
android:layout_height="24dip"
android:background="@drawable/input"
android:gravity="center"
android:text="2015-08-14"
android:textColor="#ffffff" /> <Button
android:id="@+id/btnSearch"
android:layout_width="142dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/btn_search" />
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:background="@drawable/input"
android:gravity="center_vertical"
android:orientation="horizontal" > <TextView
android:id="@+id/tvNo"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="订单号"
android:textColor="@color/white" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff" /> <TextView
android:id="@+id/tvAmount"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="金额"
android:textColor="@color/white" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff" /> <TextView
android:id="@+id/tvState"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="状态"
android:textColor="@color/white" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff" /> <TextView
android:id="@+id/tvTime"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="添加时间"
android:textColor="@color/white" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff" /> <TextView
android:id="@+id/tvOperate"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="操作"
android:textColor="@color/white" />
</LinearLayout> <ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:fadingEdgeLength="0dp" >
</ListView>
</LinearLayout> </RelativeLayout>

引用布局:items.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="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center_vertical"
android:background="@drawable/input"
android:orientation="horizontal" > <TextView
android:id="@+id/tvNo"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:textColor="@color/white"
android:text="订单号" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff"
/>
<TextView
android:id="@+id/tvAmount"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/white"
android:text="金额" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff"
/>
<TextView
android:id="@+id/tvState"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/white"
android:text="状态" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff"
/>
<TextView
android:id="@+id/tvTime"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:textColor="@color/white"
android:text="添加时间" /> <View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#ffffff"
/>
<TextView
android:id="@+id/tvOperate"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:textColor="@color/white"
android:text="操作" /> </LinearLayout>
</LinearLayout>

Java类进行列表项内容的添加

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView; public abstract class MyAdapter extends BaseAdapter {
private Context context;
public MyAdapter(Context context){
this.context = context;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHoller v;
if(convertView==null){
v = new ViewHoller();
convertView = LayoutInflater.from(context).inflate(R.layout.items, null);
v.mTvNo = (TextView) convertView.findViewById(R.id.tvNo);
v.mTvAmount = (TextView) convertView.findViewById(R.id.tvAmount);
v.mTvState = (TextView)convertView.findViewById(R.id.tvState);
v.mTvTime = (TextView)convertView.findViewById(R.id.tvTime);
v.mTvOperate = (TextView)convertView.findViewById(R.id.tvOperate);
convertView.setTag(v); }else{
v = (ViewHoller) convertView.getTag();
}
v.mTvNo.setText("201508281043");
v.mTvAmount.setText("168");
v.mTvState.setText("已发货");
v.mTvTime.setText("2015-08-28 10:43");
v.mTvOperate.setText(""); return convertView;
} class ViewHoller{
TextView mTvNo,mTvAmount,mTvState,mTvTime,mTvOperate;
}
}

加载列表项

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView; public class QueryShopping extends AppCompatActivity {
private ListView mlistView;
private MyAdapter myAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_query_shopping); mlistView = (ListView)findViewById(R.id.listView1);
}
}

Android物联网应用程序开发(智慧城市)—— 查询购物信息界面开发的更多相关文章

  1. Android物联网应用程序开发(智慧城市)—— 摄像头监控界面开发

    效果: 布局代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns: ...

  2. Android物联网应用程序开发(智慧城市)—— 火焰监控界面开发

    效果: 布局代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns: ...

  3. Android物联网应用程序开发(智慧城市)—— 购物信息的存储界面开发

    效果: 布局代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...

  4. 【可视化大屏教程】用Python开发智慧城市数据分析大屏!

    目录 一.开发背景 二.讲解代码 2.1 大标题+背景图 2.2 各区县交通事故统计图-系列柱形图 2.3 图书馆建设率-水球图 2.4 当年城市空气质量aqi指数-面积图 2.5 近7年人均生产总值 ...

  5. JAVA 图形开发中组件对齐方法及界面开发

    /*文章中用到的代码只是一部分,需要源码的可通过邮箱联系我 1978702969@qq.com*/ 在上篇博客中提到了JAVA图形界面开发时的两种布局,流式布局和边框布局. 在实际使用中可能会发现,往 ...

  6. Android物联网应用程序开发(智慧城市)—— 用户注册界面开发

    效果: 布局代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns: ...

  7. Android物联网应用程序开发(智慧城市)—— 环境状态值范围设置界面开发

    效果图: 代码: 布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns ...

  8. Android物联网应用程序开发(智慧园区)—— 图片预览界面

    效果图: 实现步骤: 1.首先在 build.gradle 文件中引入 RecycleView implementation 'com.android.support:recyclerview-v7: ...

  9. Android物联网应用程序开发(智慧园区)—— 设置传感器阈值对话框界面

    效果图: 自定义对话框布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xml ...

随机推荐

  1. [转]C++中const的使用

    原文链接:http://www.cnblogs.com/xudong-bupt/p/3509567.html 平时在写C++代码的时候不怎么注重const的使用,长久以来就把const的用法忘记了 写 ...

  2. java 整型

    byte(1字节).short(2字节).int(4字节).long(16字节) java中前缀加上0b或者0B就可以写二进制数,前缀加上0就可以写八进制数,前缀加上0x或者0X就可以写十六进制数 一 ...

  3. 对于React各种状态管理器的解读

    首先我们要先知道什么是状态管理器,这玩意是干啥的? 当我们在多个页面中使用到了相同的属性时就可以用到状态管理器,将这些状态存到外部的一个单独的文件中,不管在什么时候想使用都可以很方便的获取. reac ...

  4. java多线程5:线程间的通信

    在多线程系统中,彼此之间的通信协作非常重要,下面来聊聊线程间通信的几种方式. wait/notify 想像一个场景,A.B两个线程操作一个共享List对象,A对List进行add操作,B线程等待Lis ...

  5. Linux入侵 反弹shell

    目录 一.简介 二.命令 三.NetCat 一.简介 黑入服务器很少会是通过账号密码的方式进入,因为这很难破解密码和很多服务器都做了限制白名单. 大多是通过上传脚本文件,然后执行脚本开启一个端口,通过 ...

  6. Python语法之基本数据类型

    一.数据类型之字符串str 作用:主要用于记录描述性性质的数据,如姓名.地址.邮箱: 定义: 方式1 # 单引号 name = 'jason' 方式2 # 双引号 name = "jason ...

  7. 数据脱敏 t-closeness介绍与实现

    数据脱敏 t-closeness介绍与实现 本文主要基于t-closeness的首次提出团队Ninghui Li, Tiancheng Li, Suresh Venkatasubramanian发表的 ...

  8. MySQL管理之道,性能调优,高可用与监控(第二版)pdf下载

    MySQL管理之道,性能调优,高可用与监控(第二版) 书中内容以实战为导向,所有内容均来自于笔者多年实践经验的总结和新知识的拓展,同时也针对运维人员.DBA等相关工作者会遇到的有代表性的疑难问题给出了 ...

  9. 工作簿拆分(Excel代码集团)

    一个工作簿中包括N个工作表,将各个工作表拆分成工作簿. 工作表数量不定,表内内容不限,拆分后保存于当前文件夹内. Sub Sample() Dim MySheetsCount As Long For ...

  10. CF570A Elections 题解

    Content 有 \(n\) 个候选人和 \(m\) 个城市,每个城市可以给每个候选人投票,已知第 \(i\) 个城市给第 \(j\) 个人投的选票数是 \(a_{i,j}\).我们将第 \(i\) ...