第二次迭代感想

第二次写代码在第一次的相比下就有了一些顺手或者说有了方向感,这次我做的任务是菜单界面和下单实现功能这是我设计的界面:

 

打开的界面如下我的主要XML代码是:

.........

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tl_custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">

</android.support.v7.widget.Toolbar>

........
这个布局就是上面绿色的设计部分。
.......
<LinearLayout 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"
android:id="@+id/ll_main"
android:orientation="vertical"
tools:context=".MainActivity">
<!--Toolbar-->
<include layout="@layout/custom_toolbar" />
<!--DrawerLayout-->
<include layout="@layout/custom_drawerlayout" />


</LinearLayout>
..........
这部分代码为下面图标整体设计主布局为以下代码:
.........
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dl_left"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--主布局-->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/activity_bottom_menu" />
</FrameLayout>
<!--侧滑菜单-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:layout_gravity="start">
<include
layout="@layout/drawer_header"
/>
<ListView
android:id="@+id/lv_left_menu"
android:layout_marginTop="195dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:divider="@null"
android:text="DrawerLayout" />
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
........
主布局的设计让整个界面就完善很多 ,插入对应的菜单图片和价格。实现的功能界面如下:

 

整个主界面就有完善的感觉,并且它们的相应的菜单图片和数量都已经完善。之后进行代码进行跳转,并且可以设计数量向上累计功能。主要的代码如下:
.......
public class Food {
private int id;
private String name;//名称
private String img;//图片
private String count ;//访问次数

private int number ;

public Food(int id, String name, String img, String count) {
this.id = id;
this.name = name;
this.img = img;
this.count = count;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getImg() {
return img;
}

public void setImg(String img) {
this.img = img;
}

public String getCount() {
return count;
}

public void setCount(String count) {
this.count = count;
}

@Override
public String toString() {
return "Food{" +
"id=" + id +
", name='" + name + '\'' +
", img='" + img + '\'' +
", count=" + count +
'}';
}
}
........
该代码实现就是数量累计功能 ,选择食物可以增加减。整个功能需要跳转,数字累计等功能实现。代码量平分下来还是很可观需要编写测试,所以小组合作并且每个人的知识储备也必须跟上。



转载于:https://www.cnblogs.com/32zmx/p/6809822.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值