Android实验一实验报告

  • 格式:docx
  • 大小:145.79 KB
  • 文档页数:22

学习文档 仅供参考

Android实验报告一

:丁军峰

班级:信科12-3

学号:08123448 学习文档 仅供参考 学习文档 仅供参考

一、 实验内容

编写一个Android应用程序,实现对自己物品的管理,功能包括添加、删除和查询等

二、 实验目的

了解android开发流程,掌握SQLite数据库和ListView控件的使用

三、 需求分析

使用SQLite数据库,使用ListView控件显示物品

四、 实验过程

1. 创建程序,设计用户交互界面

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="0dp" 学习文档 仅供参考 android:layout_weight="1"

android:orientation="vertical">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="物品清单"

/>

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="物品名称"/>

android:id="@+id/id_et_stuffname"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:inputType="text"/>

android:layout_width="match_parent" 学习文档 仅供参考 android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="物品个数"/>

android:id="@+id/id_et_stuffamount"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:inputType="text"/>

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="物品价格"/>

android:id="@+id/id_et_stuffprize"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:inputType="text"/> 学习文档 仅供参考

android:layout_width="match_parent"

android:layout_height="wrap_content"

>

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="horizontal">

android:id="@+id/id_bt_add"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="添加记录"

android:layout_marginLeft="10dp"

android:layout_marginRight="10dp"

android:layout_marginTop="6dp"

android:layout_marginBottom="7dp"

android:gravity="center"

android:padding="5dp" 学习文档 仅供参考 android:textColor="#727272"

android:background="@drawable/recordbutton"

android:minHeight="0dp"/>

android:id="@+id/id_bt_all"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="显示全部"

android:layout_marginLeft="10dp"

android:layout_marginRight="10dp"

android:layout_marginTop="6dp"

android:layout_marginBottom="7dp"

android:gravity="center"

android:padding="5dp"

android:textColor="#727272"

android:background="@drawable/recordbutton"

android:minHeight="0dp" />

android:layout_width="match_parent"

android:layout_height="1dp"

android:background="#eee"/>

学习文档 仅供参考

2.创建ListView Item布局

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="horizontal"

android:background="#ffffffff">

android:id="@+id/id_ig_name"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:src="@drawable/ic_menu_paste_holo_light"/>

android:id="@+id/id_tv_name"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"