Android物联网应用程序开发(智慧城市)—— 查询购物信息界面开发

简介: Android物联网应用程序开发(智慧城市)—— 查询购物信息界面开发

效果:


83.png


布局代码:


<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);
    }
}


相关实践学习
阿里云AIoT物联网开发实战
本课程将由物联网专家带你熟悉阿里云AIoT物联网领域全套云产品,7天轻松搭建基于Arduino的端到端物联网场景应用。 开始学习前,请先开通下方两个云产品,让学习更流畅: IoT物联网平台:https://iot.console.aliyun.com/ LinkWAN物联网络管理平台:https://linkwan.console.aliyun.com/service-open
相关文章
|
7月前
|
移动开发 前端开发 Android开发
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
1374 12
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
|
7月前
|
移动开发 JavaScript 应用服务中间件
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
1002 5
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
|
7月前
|
移动开发 Rust JavaScript
【01】首页建立-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【01】首页建立-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
1097 4
【01】首页建立-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
|
7月前
|
移动开发 Android开发
【03】建立隐私关于等相关页面和内容-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【03】建立隐私关于等相关页面和内容-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
376 0
|
传感器 人工智能 物联网
健康监测设备的技术革命:AI+物联网如何让你随时掌握健康数据?
健康监测设备的技术革命:AI+物联网如何让你随时掌握健康数据?
1487 19
|
存储 安全 物联网
政府在推动物联网技术标准和规范的统一方面可以发挥哪些作用?
政府在推动物联网技术标准和规范的统一方面可以发挥哪些作用?
538 60
|
安全 物联网 物联网安全
制定统一的物联网技术标准和规范的难点有哪些?
制定统一的物联网技术标准和规范的难点有哪些?
628 58
|
存储 数据采集 物联网
物联网技术在物流领域的应用会遇到哪些挑战?
物联网技术在物流领域的应用会遇到哪些挑战?
897 60
|
供应链 物联网 区块链
探索未来技术潮流:区块链、物联网、虚拟现实的融合与创新
【10月更文挑战第41天】随着科技的不断进步,新技术如区块链、物联网、虚拟现实等正在逐步渗透到我们的日常生活中。本文将深入探讨这些技术的发展趋势和应用场景,以及它们如何相互融合,共同推动社会的进步。我们将通过具体的代码示例,展示这些技术在实际应用中的潜力和价值。无论你是科技爱好者,还是对未来充满好奇的探索者,这篇文章都将为你打开一扇通往未来的窗口。
305 56
|
安全 物联网 物联网安全
揭秘区块链技术在物联网(IoT)安全中的革新应用
揭秘区块链技术在物联网(IoT)安全中的革新应用

相关产品

  • 物联网平台