效果:

布局代码:

<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. 关于java构造器

    关于java的构造器.首先构造器并不会创建java对象,构造器知识负责执行初始化,在构造器执行之前,Java对象所需要的内存空间是由new关键字申请出来的.大部分时候,程序使用new关键字为一个Jav ...

  2. Redis集群的三种模式

    一.主从模式 通过持久化功能,Redis保证了即使在服务器重启的情况下也不会损失(或少量损失)数据,因为持久化会把内存中数据保存到硬盘上,重启会从硬盘上加载数据. 但是由于数据是存储在一台服务器上的, ...

  3. 【编程思想】【设计模式】【结构模式Structural】MVC

    Python版 https://github.com/faif/python-patterns/blob/master/structural/mvc.py #!/usr/bin/env python ...

  4. 图书管理系统总结——JAVA Swing控件简介

    断断续续学习JAVA语言,写了一个多月数据库大作业,终于在五一过后写完了.由于第一次使用JAVA和数据库,遇到了许多问题,记录下来,以备以后查看. 我使用的JAVA SE,说实话,在开发后期,觉得JA ...

  5. linux 彻底卸载mysql

    1.  停止 mysql 服务: systemctl stop mysqld.service 2. yum remove mysql (因为 之前是通过 yum -y install 方式安装的 ) ...

  6. MFC入门示例之访问对话框控件的7种方法

    方法一: 1 //方法一 2 void CMFCApplication2Dlg::OnBnClickedButton1() 3 { 4 int num1, num2, num3; 5 TCHAR ch ...

  7. Android CameraX 打开摄像头预览

    目标很简单,用CameraX打开摄像头预览,实时显示在界面上.看看CameraX有没有Google说的那么好用.先按最简单的来,把预览显示出来. 引入依赖 模块gradle的一些配置,使用的Andro ...

  8. Python把两个列表索引相同的值相加

    方案一 list1=[1,2,3,4,5] list2=[6,7,8,9,10] list3=[] list3=[i + j for i, j in zip(list1, list2)] print( ...

  9. BUU PWN hitcontraining_bamboobox

    本来想学习house of force,结果没用就直接做出来了...我用了三种方法来做这道题. 1.fastbins attack 2.unlink 3.house of force 可以改写got表 ...

  10. CF20B Equation 题解

    Content 解方程 \(ax^2+bx+c=0\). 数据范围:\(-10^5\leqslant a,b,c\leqslant 10^5\). Solution 很明显上求根公式. 先来给大家推推 ...