Android实战之淘宝领券(二)
项目创建
- 先创建所需要的包
- 先导入包
- 首页分析
先创建所需要的包
base:用于存放基类
model:用于存放数据,这里是MVP中的 M。
view:用于存放逻辑层的需要的View,这里是MVP中的 V。
presenter:用于存放逻辑层,这里是MVP中的P
- ui:里面包括
1. activity
2. adapter
3. fragment
4. custom :自定义控件
utils: 工具类
先导入包
implementation fileTree(dir: 'libs', include: ['*.jar'])implementation 'androidx.appcompat:appcompat:1.1.0'implementation 'androidx.constraintlayout:constraintlayout:1.1.3'testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test:runner:1.2.0'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'implementation 'com.google.android.material:material:1.2.0-alpha06'implementation 'com.squareup.retrofit2:retrofit:2.8.1'implementation 'com.squareup.retrofit2:converter-gson:2.8.1'implementation 'com.github.bumptech.glide:glide:4.11.0'annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'implementation 'androidx.recyclerview:recyclerview:1.1.0'implementation 'com.jakewharton:butterknife:10.2.1'annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'//基础工具库implementation "com.github.tamsiree.RxTool:RxKit:v2.4.1"//UI库implementation "com.github.tamsiree.RxTool:RxUI:v2.4.1"//(依赖RxUI库时,需要额外依赖 cardview 库)//noinspection GradleCompatibleimplementation 'com.android.support:cardview-v7:27.1.1'//功能库(Zxing扫描与生成二维码条形码 支付宝 微信)implementation "com.github.tamsiree.RxTool:RxFeature:v2.4.1"implementation 'com.google.zxing:android-core:3.3.0'implementation 'com.google.zxing:core:3.3.2'implementation project(path: ':refreshlibrary')
首页分析
当我们点击页面的底部tab时,上面可以进行切换。
我们可以分为上下结构。
底部为导航栏,上面为容器,容器使用fragment实现,底部切换时,顶部进行切换。
首页
首页里面再继续划分,顶部为搜索部分,然后是指示器,接着是内容。
内容可以使用fragment来实现,跟指示器联动,可以加上ViewPager。
精选,特惠,搜索
精选,特惠,搜索这几个页面都是单页,不有二级界面了。
扫描、领券
可以使用一个activity即可
如些,我们先实现底部的导航,其他的后面实现。
底部导航栏
我们创建项目的时候,添加了依赖,Material的依赖。
这个库里有一个BottomNavigationView
我们使用这个控件就可以实现底部的导航栏。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".ui.activity.MainActivity"><FrameLayoutandroid:layout_width="match_parent"android:layout_height="match_parent" /><com.google.android.material.bottomnavigation.BottomNavigationViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:background="@color/white"app:menu="@menu/my_navigation_items" /></RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:id="@+id/home"android:icon="@mipmap/home_normal"android:title="@string/text_home" /><itemandroid:id="@+id/selected"android:icon="@mipmap/select_normal"android:title="@string/text_selected" /><itemandroid:id="@+id/red_packet"android:icon="@mipmap/red_packet_normal"android:title="@string/text_red_packet" /><itemandroid:id="@+id/search"android:icon="@mipmap/search_normal"android:title="@string/text_search" />
</menu>
效果如下
颜色,我们下回在修改
Android实战之淘宝领券(二)相关推荐
- Python项目实战 —— 04. 淘宝用户行为分析
Python项目实战 Python项目实战--目录 Python项目实战 -- 04. 淘宝用户行为分析 一.背景 二.解题思路 三.数据分析 3.1 数据清洗 3.2 数据分析 3.2.1 用户整体 ...
- 前端案例——2.仿淘宝关闭二维码案例
<!-- 仿淘宝关闭二维码案例 --> <!-- 核心思路:利用样式的显示和隐藏完成,display:none隐藏元素:display:block显示元素. --> <! ...
- Python实战:淘宝自动抢购
Python实战:淘宝自动抢购 淘宝的限时抢购活动让许多消费者都感到头痛,往往在短时间内就被抢空了.有没有想过用Python写一个抢购程序呢?今天我们就来一起学习如何使用Python实现淘宝自动抢购. ...
- [淘宝客技术篇006]如何登录阿里妈妈-《登录淘宝网·二维码实现法》(下)
<登录淘宝网·二维码实现法> 如下图所示,详解各步骤: 1.用户请求登录: 2.请求获取二维码.请求地址:https://qrlogin.taobao.com/qrcodelogin/ge ...
- js: 动画 筋斗云导航栏 仿淘宝关闭二维码
筋斗云导航栏 <!DOCTYPE html> <html> <head lang="en"><meta charset="UTF ...
- Dom——仿淘宝关闭二维码
仿淘宝关闭二维码 效果 整体的样式如上图所示.(素材图片可去淘宝保存图片) 当点击二维码广告旁边的叉叉,则会把广告关闭. 核心思路 点击叉叉,关闭整个广告,则需要的事件源有叉叉符号,整个广告盒子:事件 ...
- DOM ------ 仿淘宝关闭二维码
仿淘宝关闭二维码 完成效果如下: //css代码.box{position: relative;width: 74px;height: 88px;border: 1px solid #ccc;marg ...
- Android Studio 集成淘宝三方登录
满足下面条件1-- classpath 'com.android.tools.build:gradle:2.3.2' 版本不要高于3.02-- 通过阿里百川开通应用3-- 项目开通过电商能力4-- 项 ...
- Android Virtualview:淘宝、天猫又开源了一个动态化、高性能的UI框架
转载 Carson_Ho Android Virtualview:淘宝.天猫又开源了一个动态化.高性能的UI框架 前言 目录 1. 为什么要向 Tangram模型 加入 VirtualView 2. ...
- 2016双十二淘宝推出“二次元日”
PR星人 文/天下网商记者王佳健 漫展是二次元消费在线下的重要场景,诸如动漫周边.Cosplay表演.声优歌手及漫画家签售等,丰富的内容让漫展成为漫迷心中的盛会,也撩动着二次元人群的消费激情. 今年淘 ...
最新文章
- Android10.0 日志系统分析(一)-logd、logcat 指令说明、分类和属性-[Android取经之路]
- 编程语言python入门要电脑什么配置能带动-Python是万能的编程语言吗?这五大用途很重要!...
- LeetCode题组:第121题-买卖股票的最佳时机
- nginx下部署vue项目
- halcon的算子清点:Chapter 9 匹配
- jquery ui动态切换主题的一种实现方式
- AT2300-[ARC068C]Snuke Line【整除分块】
- python123不能登录_python用户登录,密码错误3次则锁定
- a href=javascript:;/a
- Kubernetes-2018干货盘点
- kali linux 桌面消失_Kali Linux添加桌面快捷方式
- Longest Common Substring($LCS$)
- 小米蓝牙音响驱动_拆解报告:小米无线充蓝牙音箱
- 110千伏变电站对人体的危害
- 成为优秀软件工程师的三条路径
- 国内和国外DNS服务器地址 全国各地电信DNS服务器地址
- 弄懂这56个Python技巧,秒变Python大神
- windows上安装linux_Linux系统安装Windows软件? 通过这个工具可以做到
- restrict关键
- Linux常用服务部署与优化
热门文章
- 19.敏捷项目管理流程实例 - 变更管理
- 电动汽车用内置式永磁同步电机基于查询表 的矢量控制算法, 自动生成满足 MTPA
- 关于 HTTP 长连接
- APDU应用协议数据单元
- 使用html语言编写收银系统,蓝色简洁样式html5店铺收银系统网页模板
- Canoe-基于14229的UDS自动化测试脚本CAPL 这适用于CANoe无diva的测试脚本
- win10 清理回收站右键
- 在计算机里面建一个新的文档,电脑上的word怎么新建文档
- 数车计算机编程教学caxa,caxa数控车视频教程软件编程全套2016/2015
- MSP430常见问题之开发工具类