先附上GitHub:https://github.com/LiuJingyingdev/Food

再附几张效果图:

主要用到的知识点,RecyclerView显示列表,ScollView,Materil Design的部分设计,导航栏用RadioGroup+Fragment,Intent传输数据,Selector(背景选择器),Shap样式等等。

下面是部分代码:

主活动:MainMenu

package com.example.food;import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;import java.io.EOFException;
import java.util.ArrayList;
import java.util.List;import adapter.OderAdapter;
import adapter.Order;
import adapter.Person;
import adapter.PersonAdapter;
import adapter.Store;
import adapter.StoreAdapter;
import fragment.CarFragment;
import fragment.MenuFragment;
import fragment.PersonFragment;//主菜单
public class MainMenu extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {private MenuFragment menuFragment;private CarFragment carFragment;private PersonFragment personFragment;private FragmentManager fragmentManager;private List<Store> storeList = new ArrayList<>();//首页商店的列表private List<Order> OrderList = new ArrayList<>();//订单列表private List<Person> personList = new ArrayList<>();//个人中心的列表RadioButton menu_Button;RadioButton car_Button;RadioButton person_Button;private Boolean a, b, c;private Boolean first;private RadioGroup chooseGroup;//单选按钮组,用来获取单选按钮响应事件private RadioButton defaultButton;//默认单选按钮@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {Window window = getWindow();
//设置修改状态栏window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
//设置状态栏的颜色,和你的app主题或者标题栏颜色设置一致就ok了window.setStatusBarColor(getResources().getColor(R.color.gray));}setContentView(R.layout.activity_main_menu);a = false;//首页碎片状态b = false;//订单碎片状态c = false;//个人中心碎片状态//初始化列表initSore();initOrder();iniPerson();menu_Button = (RadioButton) findViewById(R.id.radio_button1);car_Button = (RadioButton) findViewById(R.id.radio_button2);person_Button = (RadioButton) findViewById(R.id.radio_button3);changeImageSize(menu_Button, car_Button, person_Button);//改变底部单选按钮的大小chooseGroup = (RadioGroup) findViewById(R.id.choose_group);chooseGroup.setOnCheckedChangeListener(this);first = false;//判断事务是否第一次进行fragmentManager = getSupportFragmentManager();android.support.v4.app.FragmentTransaction myfragmentTransaction = fragmentManager.beginTransaction();if (menuFragment == null) {menuFragment = new MenuFragment();myfragmentTransaction.add(R.id.frame_layout, menuFragment);}if (carFragment == null) {carFragment = new CarFragment();myfragmentTransaction.add(R.id.frame_layout, carFragment);}if (personFragment == null) {personFragment = new PersonFragment();myfragmentTransaction.add(R.id.frame_layout, personFragment);}if (!first) {myfragmentTransaction.hide(carFragment);myfragmentTransaction.hide(personFragment);myfragmentTransaction.show(menuFragment);myfragmentTransaction.commit();}// menu_Button.setChecked(true);//让首页默认选中//defaultButton = (RadioButton) findViewById(R.id.radio_button1);//用来判断碎片的状态,是实例化了,还是空值}@Overridepublic void onCheckedChanged(RadioGroup radioGroup, int i) {switch (i) {case R.id.radio_button1: {Select(1);break;}case R.id.radio_button2: {Select(2);break;}case R.id.radio_button3: {Select(3);break;}}}@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.imageButton1: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "美食");startActivity(intent);break;}case R.id.imageButton2: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "超市");startActivity(intent);break;}case R.id.imageButton3: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "生鲜");startActivity(intent);break;}case R.id.imageButton4: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "专送");startActivity(intent);break;}case R.id.imageButton5: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "代购");startActivity(intent);break;}case R.id.imageButton6: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "午餐");startActivity(intent);break;}case R.id.imageButton7: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "甜品");startActivity(intent);break;}case R.id.imageButton8: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "家常");startActivity(intent);break;}case R.id.imageButton9: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "小吃");startActivity(intent);break;}case R.id.imageButton10: {Intent intent = new Intent(MainMenu.this, MyClassify.class);intent.putExtra("class_type", "快餐");startActivity(intent);break;}default:break;}}private void Select(int i) {
//        android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
//        android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();initFragment(fragmentTransaction);if (i == 1) {//用recyclerView陈列商店列表if (menuFragment == null) {menuFragment = new MenuFragment();fragmentTransaction.add(R.id.frame_layout, menuFragment);Log.d("TAG1", "加法减法就爱看放假啊垃圾分类卡机了开发");} else {if (!a) {Log.d("TAG2", "奥卡福捡垃圾反垃圾发了简历发借记卡");RecyclerView recyclerView1 = (RecyclerView) findViewById(R.id.recycler_view);LinearLayoutManager layoutManager1 = new LinearLayoutManager(this);layoutManager1.setOrientation(LinearLayoutManager.VERTICAL);recyclerView1.setLayoutManager(layoutManager1);//recyclerView1.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));StoreAdapter adapter1 = new StoreAdapter(storeList);recyclerView1.setAdapter(adapter1);//处理recyclerview和scrollview滑动冲突recyclerView1.setHasFixedSize(true);recyclerView1.setNestedScrollingEnabled(false);a = true;}Log.d("TAG3", ";类分类法放假啊洛夫克拉夫垃圾卡进了房间all结案率会计分录");//图片按钮ImageButton imageButton1;ImageButton imageButton2;ImageButton imageButton3;ImageButton imageButton4;ImageButton imageButton5;ImageButton imageButton6;ImageButton imageButton7;ImageButton imageButton8;ImageButton imageButton9;ImageButton imageButton10;//                //首页显示的情况下,再获取首页中的控件
//                android.support.v4.app.FragmentManager manager;
//                MenuFragment fragment;
//
//                //下面是处理首页的ImagaButton的点击事件
//                /*获取manager*/
//                manager = this.getSupportFragmentManager();
//        /*通过findFragmentById获取Fragment*/
//                fragment = (MenuFragment) manager.findFragmentById(R.id.frame_layout);
//        /*通过fragment.getView()获取视图,然后在获取fragment中的button*/imageButton1 = (ImageButton) findViewById(R.id.imageButton1);imageButton2 = (ImageButton) findViewById(R.id.imageButton2);imageButton3 = (ImageButton) findViewById(R.id.imageButton3);imageButton4 = (ImageButton) findViewById(R.id.imageButton4);imageButton5 = (ImageButton) findViewById(R.id.imageButton5);imageButton6 = (ImageButton) findViewById(R.id.imageButton6);imageButton7 = (ImageButton) findViewById(R.id.imageButton7);imageButton8 = (ImageButton) findViewById(R.id.imageButton8);imageButton9 = (ImageButton) findViewById(R.id.imageButton9);imageButton10 = (ImageButton) findViewById(R.id.imageButton10);imageButton1.setOnClickListener(this);imageButton2.setOnClickListener(this);imageButton3.setOnClickListener(this);imageButton4.setOnClickListener(this);imageButton5.setOnClickListener(this);imageButton6.setOnClickListener(this);imageButton7.setOnClickListener(this);imageButton8.setOnClickListener(this);imageButton9.setOnClickListener(this);imageButton10.setOnClickListener(this);fragmentTransaction.show(menuFragment);//显示首页碎片}}if (i == 2) {if (carFragment == null) {carFragment = new CarFragment();fragmentTransaction.add(R.id.frame_layout, carFragment);} else {if (!b) {RecyclerView recyclerView2 = (RecyclerView) findViewById(R.id.order_recylerview);LinearLayoutManager layoutManager2 = new LinearLayoutManager(this);recyclerView2.setLayoutManager(layoutManager2);OderAdapter adapter2 = new OderAdapter(OrderList);recyclerView2.setAdapter(adapter2);b = true;}fragmentTransaction.show(carFragment);//显示订单碎片}}if (i == 3) {if (personFragment == null) {personFragment = new PersonFragment();fragmentTransaction.add(R.id.frame_layout, personFragment);} else {if (!c) {RecyclerView recyclerView3 = (RecyclerView) findViewById(R.id.person_recyclerview);LinearLayoutManager layoutManager3 = new LinearLayoutManager(this);recyclerView3.setLayoutManager(layoutManager3);PersonAdapter adapter3 = new PersonAdapter(personList);recyclerView3.setAdapter(adapter3);c = true;}fragmentTransaction.show(personFragment);//显示个人中心碎片}}fragmentTransaction.commit();//碎片提交事物}public void initFragment(android.support.v4.app.FragmentTransaction fragmentTransaction) {//初始化碎片if (menuFragment != null) {fragmentTransaction.hide(menuFragment);}if (carFragment != null) {fragmentTransaction.hide(carFragment);}if (personFragment != null) {fragmentTransaction.hide(personFragment);}}private void initSore() {Store a = new Store("原味坊", R.drawable.p1);storeList.add(a);Store b = new Store("大雄美食(玫瑰园店)", R.drawable.p2);storeList.add(b);Store c = new Store("陈生陈太", R.drawable.p3);storeList.add(c);Store d = new Store("非尝不可", R.drawable.p4);storeList.add(d);Store e = new Store("特工厨房", R.drawable.p5);storeList.add(e);Store f = new Store("先入为煮", R.drawable.p6);storeList.add(f);Store g = new Store("蜀园川菜馆", R.drawable.p7);storeList.add(g);Store h = new Store("私家屋", R.drawable.p8);storeList.add(h);Store i = new Store("Q堡堡", R.drawable.p9);storeList.add(i);Store j = new Store("沙县小吃", R.drawable.p10);storeList.add(j);Store k = new Store("德乐士(玫瑰园店)", R.drawable.p11);storeList.add(k);Store l = new Store("陈记关东煮", R.drawable.p12);storeList.add(l);Store m = new Store("正兴鸡扒", R.drawable.p13);storeList.add(m);Store n = new Store("叫了只炸鸡", R.drawable.p14);storeList.add(n);Store o = new Store("味食先", R.drawable.p15);storeList.add(o);}private void initOrder() {Order a = new Order("原味坊", R.drawable.p1);OrderList.add(a);Order b = new Order("大雄美食(玫瑰园店)", R.drawable.p2);OrderList.add(b);Order c = new Order("陈生陈太", R.drawable.p3);OrderList.add(c);Order d = new Order("非尝不可", R.drawable.p4);OrderList.add(d);Order e = new Order("特工厨房", R.drawable.p5);OrderList.add(e);Order f = new Order("先入为煮", R.drawable.p6);OrderList.add(f);Order g = new Order("蜀园川菜馆", R.drawable.p7);OrderList.add(g);Order h = new Order("私家屋", R.drawable.p8);OrderList.add(h);Order i = new Order("Q堡堡", R.drawable.p9);OrderList.add(i);Order j = new Order("沙县小吃", R.drawable.p10);OrderList.add(j);Order k = new Order("德乐士(玫瑰园店)", R.drawable.p11);OrderList.add(k);Order l = new Order("陈记关东煮", R.drawable.p12);OrderList.add(l);Order m = new Order("正兴鸡扒", R.drawable.p13);OrderList.add(m);Order n = new Order("叫了只炸鸡", R.drawable.p14);OrderList.add(n);Order o = new Order("味食先", R.drawable.p15);OrderList.add(o);}private void iniPerson() {Person a = new Person("巴哥红包");personList.add(a);Person b = new Person("商家代金券");personList.add(b);Person c = new Person("我的地址");personList.add(c);Person d = new Person("邀请有奖");personList.add(d);Person e = new Person("客服中心");personList.add(e);Person f = new Person("帮助和反馈");personList.add(f);Person g = new Person("协议和说明");personList.add(g);}private void changeImageSize(RadioButton menu_Button, RadioButton car_Button, RadioButton person_Button) {//定义底部标签图片大小Drawable drawableFirst = getResources().getDrawable(R.drawable.menu);drawableFirst.setBounds(0, 0, 69, 69);//第一0是距左右边距离,第二0是距上下边距离,第三69长度,第四宽度menu_Button.setCompoundDrawables(null, drawableFirst, null, null);//只放上面Drawable drawableSearch = getResources().getDrawable(R.drawable.car);drawableSearch.setBounds(0, 0, 69, 69);//第一0是距左右边距离,第二0是距上下边距离,第三69长度,第四宽度car_Button.setCompoundDrawables(null, drawableSearch, null, null);//只放上面Drawable drawableMe = getResources().getDrawable(R.drawable.person);drawableMe.setBounds(0, 0, 69, 69);//第一0是距左右边距离,第二0是距上下边距离,第三69长度,第四宽度person_Button.setCompoundDrawables(null, drawableMe, null, null);//只放上面}}

底部导航栏布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="wrap_content"><RadioGroupandroid:id="@+id/choose_group"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_gravity="center"><RadioButtonandroid:id="@+id/radio_button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="首页"android:textColor="@drawable/menu_text"android:layout_weight="1"style="@style/radioStyle"android:drawableTop="@drawable/menu"></RadioButton><RadioButtonandroid:id="@+id/radio_button2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="订单"android:textColor="@drawable/car_text"android:layout_weight="1"style="@style/radioStyle"android:drawableTop="@drawable/car"></RadioButton><RadioButtonandroid:id="@+id/radio_button3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="我的"android:textColor="@drawable/person_text"android:layout_weight="1"style="@style/radioStyle"android:drawableTop="@drawable/person"></RadioButton></RadioGroup></LinearLayout>

还有很多,你们可以看看,在这里就不贴了,喜欢点赞。

Android自己仿美团做的外卖软件(巴哥外卖),新手进相关推荐

  1. 基于Android的仿美团外卖系统设计与实现 文档+源码+视频

    基于Android的仿美团外卖系统设计与实现 演示视频 摘 要 为了巩固所学 Android 基础知识,要开发一款仿美团外卖的项目,该项目与我们平常看到的美团外卖项目界面比较类似,展示的内容包括店铺. ...

  2. android仿美团论文,毕业设计(论文)-基于Android的仿美团系统.docx

    全套设计加扣 3012250582 PAGE \* MERGEFORMAT- 1 - 全套设计加扣 3012250582 湖南软件职业学院 毕业设计 毕业选题 : 基于Android的仿美团系统 指导 ...

  3. 《仿大众点评仿美团做一个评价网站——Java SSM》项目研发阶段性总结

    <仿大众点评仿美团做一个评价网站--Java SSM>项目研发阶段性总结 一.后台功能实现 (一).注册商家 (二).登录商家中心 (三).商家登录后台操作模块 (1).用户管理模块 (1 ...

  4. Android 高仿美团外卖详情页

    目录 1.需求分析 2.具体实现 2.1效果展示 2.2布局分析 2.3代码分析 2.3.1自定义 CoordinatorLayout.Behavior 2.3.2自定义 RecyclerView.I ...

  5. android高仿美团筛选控件,Android高仿美团首页分类按钮

    惯例,先上GIF 栗子.gif更新v1.1版本 2017-6-2 11:55:30 详见github 一.使用姿势 1.引入(使用Gradle或者Maven) 1)Gradleallprojects  ...

  6. android 高仿美团,Android 仿美团、大众点评团购详情UI

    在scrollview 上滑固定某一控件(美团团购详情UI)文中介绍了怎么用touchlistener实现类似上滑停住的效果,但是这种方法存在一个明显的bug,就是在内容比较多的时候, 大部分人都是以 ...

  7. Android仿美团外卖点菜联动列表

    Android高仿美团外卖点菜联动列表效果 最近项目中有一个添加购物车的需求,需要做成美团外卖点菜联动ListView的效果,可能有的朋友觉得这很简单,不就是2个Listview点击事件联动处理机制吗 ...

  8. android 仿快递步骤_Android实现仿美团、顺丰快递数据加载效果

    我们都知道在Android中,常见的动画模式有两种:一种是帧动画(Frame Animation),一种是补间动画(Tween Animation).帧动画是提供了一种逐帧播放图片的动画方式,播放事先 ...

  9. 用vue仿美团APP

    vue仿美团APP 这几天上班也不是很忙,就想着用vue做一个APP,感觉美团这个APP里面的功能比较齐全,就仿美团做了一个,但是现在我也没有充足的时间去做,只能有时间做一点,现在前面的几个大页面都做 ...

最新文章

  1. Equals方法与==运算符的使用
  2. 服务器操作系统2008安装图解,IBM服务器windows2008操作系统安装步骤图文(13页)-原创力文档...
  3. ArcGIS API for javascript开发笔记(五)——GP服务调用之GP模型的发布及使用详解...
  4. 【已解决】Error occurred during loading data. Trying to use cache server_Python系列学习笔记
  5. 解惑烟草行业工控系统如何风险评估
  6. 求一个任意实数c的算术平方根g_初中数学实数相关知识点:这些小技巧,解题有大用...
  7. 如何查询以太信道接口_浅谈百兆千兆以太网物理层
  8. docker安装启动mysql5.6_mysql5.6在ubuntu下的docker中安装的方法详解
  9. 数字电子技术基础(四):门电路(二极管)
  10. linux触摸屏校准命令,Linux 触摸屏校准
  11. 无线充qi2来了,快来了解下~
  12. 智慧农业整体解决方案
  13. hibernate一对一主键关联映射(单向关联Person-----IdCard)
  14. 技术专有名词缩写整理
  15. win11 环境变量的配置
  16. 作品集一(早期共17件ps)
  17. 64位 pb12 win7 数据源_PB12新特性及介绍PB资源控件下载
  18. 还在问免费文档翻译软件哪个好用吗?这几款就很不错
  19. 重磅!南京java培训机构推荐
  20. vue学习笔记2-数据绑定

热门文章

  1. Generic design | Policies 和Policy Classes
  2. 旅行常备软件,驴友们速来
  3. JAVA安装步骤及环境配置
  4. MybatisPlus 之 插件
  5. 怎么选择聚合支付公司
  6. POJ 1062 昂贵的聘礼
  7. Nacos 1.4.1 紧急升级修复Alibaba Nacos 认证绕过漏洞
  8. 前端VUE使用web3调用小狐狸(metamask)和合约(ERC20)交互
  9. 【iOS_GitHub】评分条/星级条(类似于淘宝/京东/1号店/亚马逊等商城类的评分条,支持0.5分哦)
  10. Matlab常用数值计算函数总结