效果:

布局代码:

<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. mybatis-plus条件构造用is开头的Boolean类型字段时遇到的问题

    is打头的Boolean字段导致的代码生成器与lambda构造器的冲突 https://gitee.com/baomidou/mybatis-plus/issues/I171DD?_from=gite ...

  2. 利用unordered_map维护关联数据

    在leetcode上刷339题Evaluate Division(https://leetcode.com/problems/evaluate-division/#/description)时在脑中过 ...

  3. mysql数据库备份脚本一例

    例子,mysql数据库备份脚本.vim mysql.sh #!/bin/bash DAY=`date +%Y-%m-%d` //日期以年月日显示并赋予DAY变量 SIZE=`du -sh /var/l ...

  4. 前端两大框架 vue 和 react 的区别

    1. 设计思想 vue: vue的官网介绍说vue是一种渐进式框架,采用自底向上增量开发的设计: react: 采用函数式编程,推崇纯组件,数据不可变,单向数据流: 2. 编写语法 vue: 采用单文 ...

  5. Jetpack Compose的Modifier顺序问题

    一:前言 困惑起源于这段代码 Composable.clickable(点击1).clickable(点击2).size(100.dp).size(200.dp){ ............... } ...

  6. LuoguP7505 「Wdsr-2.5」小小的埴轮兵团 题解

    Content 给出一个范围为 \([-k,k]\) 的数轴,数轴上有 \(n\) 个点,第 \(i\) 个点的位置为 \(a_i\).有 \(m\) 次操作,有且仅有以下三种: 1 x:所有点往右移 ...

  7. MIUI12.5扫码之后无法连接MIUI+,显示连接失败

    设置-应用设置-应用管理-小米互联通信服务(如果没有找到,进行搜索即可)-清除数据 重新扫码连接就可以连上了 (感觉不怎么样,不知道是不是我网卡,用起来卡卡的...)

  8. Swagger请求报错:TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.

    TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. 如下图 ...

  9. 基于 SoC 的卷积神经网络车牌识别系统设计(0)摘要

    ​NOTES:现如今,芯片行业无比火热啊,无论是前景还是钱景,国家芯片战略的发布,公司四五十万的年薪,着实令人非常的向往,为了支持芯片设计者,集成了工作.科研.竞赛于一体的<基于 SoC 的卷积 ...

  10. nanogui源码编译+下载

    MAC 没电了,哎..... 只能使用windows10将就了.    截至目前,我已经找到了两个nanogui项目,都是大佬. 分别为: A.https://github.com/dalerank/ ...