1.创建名为Lab04的程序
a.该程序对应的布局文件,如下所示:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.bz0209.myapplication.MainActivity"> <LinearLayout android:id="@+id/addLL" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/et01" android:hint="商品名称" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"/> <EditText android:id="@+id/et02" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:hint="金额" /> <ImageView android:id="@+id/ivIcon1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="add" android:src="@android:drawable/ic_input_add" /> </LinearLayout> <ListView android:id="@+id/lv01" android:layout_width="match_parent" android:layout_height="match_parent"> </ListView> </