第三次迭代目标完成情况以及感想
第三次迭代目标完成情况如下:
首先是订单界面的设计如下:
主要XML代码是:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.edg.foodie.fragment.OrderFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:id="@+id/rl"
>
<Button
android:layout_width="178dp"
android:layout_height="wrap_content"
android:text="未完成订单"
android:textSize="20dp"
android:textColor="@color/text_white"
android:id="@+id/Nofinshbutton"
android:background="@color/colorPrimary"
/>
<Button
android:layout_width="178dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:textSize="20dp"
android:textColor="@color/text_white"
android:text="已完成订单"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/Nofinshbutton"
android:id="@+id/Finshbutton"
/>
</RelativeLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+idst_allorder">
</ListView>
</LinearLayout>
</FrameLayout>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.edg.foodie.fragment.OrderFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:id="@+id/rl"
>
<Button
android:layout_width="178dp"
android:layout_height="wrap_content"
android:text="未完成订单"
android:textSize="20dp"
android:textColor="@color/text_white"
android:id="@+id/Nofinshbutton"
android:background="@color/colorPrimary"
/>
<Button
android:layout_width="178dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:textSize="20dp"
android:textColor="@color/text_white"
android:text="已完成订单"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/Nofinshbutton"
android:id="@+id/Finshbutton"
/>
</RelativeLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+idst_allorder">
</ListView>
</LinearLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.amap.api.maps2d.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
</com.amap.api.maps2d.MapView>
</RelativeLayout>
<RelativeLayout
android:id="@+idarch_bar_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="@dimen/offset_title_left"
android:layout_marginRight="@dimen/offset_title_left"
android:layout_marginStart="@dimen/offset_title_left"
android:layout_marginTop="@dimen/offset_title_left"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/offlinearrow_tab2_pressed"
android:clickable="true"
android:gravity="center"
android:paddingEnd="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingStart="12dp"
android:text="搜索"
android:textColor="@color/white"
android:textSize="12dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/btn_search"
android:layout_toStartOf="@+id/btn_search"
android:background="@drawablearch_input_half"
android:clickable="true"
android:gravity="center_vertical" >
<EditText
android:id="@+id/input_edittext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableLeft="@drawablearch_input"
android:background="@color/trans_parent"
android:hint="请输入搜索关键字"
android:textColorHint="@color/darkgrey"
android:textColor="@color/gary"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/poi_detail"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="@drawable/border_bg"
android:visibility="gone">
<TextView
android:id="@+id/poi_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:textColor="#5566b8"
android:textSize="15sp" />
<TextView
android:id="@+id/poi_address"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/poi_name"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="#333333"
android:textSize="15sp" />
</RelativeLayout>
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.amap.api.maps2d.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
</com.amap.api.maps2d.MapView>
</RelativeLayout>
<RelativeLayout
android:id="@+idarch_bar_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="@dimen/offset_title_left"
android:layout_marginRight="@dimen/offset_title_left"
android:layout_marginStart="@dimen/offset_title_left"
android:layout_marginTop="@dimen/offset_title_left"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/offlinearrow_tab2_pressed"
android:clickable="true"
android:gravity="center"
android:paddingEnd="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingStart="12dp"
android:text="搜索"
android:textColor="@color/white"
android:textSize="12dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/btn_search"
android:layout_toStartOf="@+id/btn_search"
android:background="@drawablearch_input_half"
android:clickable="true"
android:gravity="center_vertical" >
<EditText
android:id="@+id/input_edittext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableLeft="@drawablearch_input"
android:background="@color/trans_parent"
android:hint="请输入搜索关键字"
android:textColorHint="@color/darkgrey"
android:textColor="@color/gary"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/poi_detail"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="@drawable/border_bg"
android:visibility="gone">
<TextView
android:id="@+id/poi_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:textColor="#5566b8"
android:textSize="15sp" />
<TextView
android:id="@+id/poi_address"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/poi_name"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:gravity="center_vertical"
android:textColor="#333333"
android:textSize="15sp" />
</RelativeLayout>
搜索图标的JAVA代码:
public class Searchctivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchctivity);
ImageView iv_search = (ImageView)findViewById(R.id.iv_search);
final EditText et_input = (EditText)findViewById(R.id.et_input);
iv_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(Searchctivity.this,"正在搜索 "+ et_input.getText().toString()+" ...",Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchctivity);
ImageView iv_search = (ImageView)findViewById(R.id.iv_search);
final EditText et_input = (EditText)findViewById(R.id.et_input);
iv_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(Searchctivity.this,"正在搜索 "+ et_input.getText().toString()+" ...",Toast.LENGTH_LONG).show();
}
});
}
上面的代码只是一些基本的功能,我觉得此次迭代把上个学期学习的东西又复习了一遍。