Android项目CJM9之新闻浏览模块的实现
今天看cjm9的代码时候想把模块梳理一下,顺便再熟悉下mvp,rxjava和retrofit的综合运用。我们先看图
新闻item的具体信息
图片item的具体信息
大概就是上面那样。
下面开始代码分析:
先看下分包:
下面我们看界面的布局文件:
1.fragment_explore.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextView
android:layout_width="match_parent"android:layout_height="@dimen/tab_height"android:background="@color/color_primary"android:elevation="@dimen/cardview_default_elevation"android:gravity="center_vertical"android:padding="5dp"android:text="@string/explore"android:textColor="#ffffff"android:textSize="16sp" /><LinearLayout
android:layout_width="match_parent"android:layout_height="@dimen/tab_height"android:background="@color/color_icons"android:elevation="@dimen/cardview_default_elevation"android:orientation="horizontal"><FrameLayout
android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1"><net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/magic_indicator"android:layout_width="match_parent"android:layout_height="match_parent"android:focusable="true" /><TextView
android:id="@+id/tv_section"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/color_primary_light"android:gravity="center_vertical"android:padding="5dp"android:text="@string/live_exchange"android:textColor="@color/color_icons"android:textSize="12sp" /><ImageView
android:layout_width="2dp"android:layout_height="match_parent"android:layout_gravity="end"android:alpha="0.3"android:scaleType="centerCrop"android:src="@drawable/background_shadow" /></FrameLayout><ImageView
android:id="@+id/iv_expandable"android:layout_width="@dimen/tab_height"android:layout_height="@dimen/tab_height"android:layout_weight="0"android:background="?selectableItemBackgroundBorderless"android:padding="8dp"android:scaleType="centerCrop"android:src="@drawable/ic_expand_open" /></LinearLayout><FrameLayout
android:layout_width="match_parent"android:layout_height="match_parent"><android.support.v4.view.ViewPager
android:id="@+id/viewpager"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/color_layout_background" /><ScrollView
android:id="@+id/scroll_view"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/color_layout_background"><LinearLayout
android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_selected"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1"android:background="@null" /><LinearLayout
android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="end"android:layout_weight="0"android:orientation="horizontal"><TextView
android:layout_width="match_parent"android:layout_height="wrap_content"android:padding="5dp"android:text="@string/explore_drag"android:textColor="@color/color_accent"android:textSize="12sp" /><TextView
android:layout_width="match_parent"android:layout_height="wrap_content"android:padding="5dp"android:text="@string/explore_delete"android:textColor="@color/color_error"android:textSize="12sp" /></LinearLayout><ImageView
android:layout_width="match_parent"android:layout_height="1dp"android:layout_marginLeft="5dp"android:layout_marginRight="5dp"android:layout_weight="0"android:src="@color/color_divider" /><TextView
android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="0"android:padding="5dp"android:text="点击添加更多栏目"android:textSize="12sp" /><android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_unselected"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1"android:background="@null" /></LinearLayout></ScrollView></FrameLayout></LinearLayout>
这布局搭建很巧妙,不是通过设置Visible进行小界面的替换,而是通过动画,利用framelayout的特性进行显示和消失的。
Android项目CJM9之新闻浏览模块的实现相关推荐
- 【JetPack】为现有 Android 项目配置视图绑定 ( ViewBinding ) 模块 ( 视图绑定不影响传统布局操作 | 视图绑定类关联 Activity | 视图绑定类本质 )
文章目录 I . 为现有项目配置 视图绑定 ( ViewBinding ) 应用 II . 视图绑定 ( ViewBinding ) 定制 III . 视图绑定 ( ViewBinding ) 对于正 ...
- Android项目2:新闻+视频聚合App——萌土日报
前言:本人独立开发的新闻+视频聚合App.通过这个项目,我不仅掌握了Android移动开发常见的控件和布局的使用,还有通用的框架Okhttp.Glide.Jsoup.腾讯X5WebView,能快速开发 ...
- Android项目分包(按功能模块)
分包是一个开放性的问题,它并没有固定或最优的方案,但是不好的分包策略带来的影响将会一直持续在App的开发迭代周期中,给开发带来一定的麻烦:如:耦合性 ,不易维护,重用难度高 下面介绍一下一种分包策略( ...
- 〖Python 数据库开发实战 - Python与MySQL交互篇⑫〗- 项目实战- 实现新闻管理模块
订阅 Python全栈白宝书-零基础入门篇 可报销!白嫖入口-请点击我.推荐他人订阅,可获取扣除平台费用后的35%收益,文末名片加V! 说明:该文属于 Python全栈白宝书专栏,免费阶段订阅数量43 ...
- 【Android项目实战 | 从零开始写app(十二)】实现app首页智慧服务热门推荐热门主题、新闻
说在前面,由于各种adapter,xml布局,bean实体类,Activity,也为了让看懂,代码基本都是"简单粗暴直接不好看",没啥okhttp和util工具类之类的封装,本篇幅 ...
- 【Android项目实战 | 从零开始写app(十三)】实现用户中心模块清除token退出登录信息修改等功能
五一后,被ji金伤了,哇呜呜,还是得苦逼老老实实打工写代码,看下面吧 本篇实现效果: 实现登录用户名展示到用户中心页面上,并且页面有个人信息,订单列表,修改密码,意见反馈发送到服务端,前面登录后,通过 ...
- Android公共jar,使用JitPack管理Android项目中公共模块库
随着项目的功能越来越多,代码和模块维护也越来越复杂,为了减少主项目的代码量,一般都会将一些公共使用的类或者功能模块抽离出来,与主项目解耦分离,当主项目中需要使用的时候,直接进行引用即可. 现在Andr ...
- android注册文件打开,Android项目实战系列—基于博学谷(三)注册与登录模块
由于这个模块内容较多,篇幅较长,请耐心阅读. 注册与登录模块分为三个部分 [x] [欢迎界面]() [x] [注册界面]() [x] [登录界面]() 一.欢迎界面 1.创建工程,命名为BoXueGu ...
- Android项目实战系列—基于博学谷(四)我的模块(上)
由于这个模块内容较多,篇幅较长,请耐心阅读. "我"的模块分为四个部分 我的界面 设置界面 修改密码界面 设置密保和找回密码 一."我"的界面 1.底部导航栏 ...
最新文章
- 布尔值_Python基础知识点手册——布尔值及布尔运算
- 半木下低风险交易-1
- 统计学习方法笔记(六)-非线性支持向量机原理及python实现
- thinkcmf安装模板需要点击右键打开新页面的解决办法
- LoadPostData 的一些注意事项
- 产品经理如何锻炼自己看透事物本质的能力
- node.js——麻将算法(三)胡牌相关明牌
- mysql limit 5 5 正确_MySql 5.7 同时使用order by和limit时结果集不正确的问题
- visio2013-软件UML序列图02
- 有关键词和频率,怎么求共词矩阵?有报酬
- 用友U9 UAP平台解析
- 游戏手柄计算机,电脑游戏手柄怎么设置 电脑游戏手柄设置步骤【图文】
- 嵌入式C设计模式---状态机设计模式
- judgement_mna_2016
- Kaggle注册方法
- 【Python】关键字
- 数据科学之matplotlib库
- Photoshop完全自学入门与经典实例全视频教程
- 今日头条分享干货如何引流?今日头条运营引流干货教程
- 将BT进行到底-BT客户端工具全收集
热门文章
- JAVA 导出Excel 带有多个公式函数
- css:浏览器中文字显示模糊的原因及处理方案
- 【docker】导入镜像报错磁盘空间不足的解决方法 【docker】修改默认的存储路径
- 双通道14位、500 MSPS采样率的AD9684 高速并行LVDS ADC接口介绍
- 洛谷P2058 海港(模拟,优先队列)
- UE4 VR 重置摄像机朝向
- 可以用api控制的电源开关_一种穿戴式系统电源控制器设计与实现
- 《MySQL必知必会》SQL文件
- Spring Cloud - 注册中心
- 用 Python 编程,假设一年期定期利率为 3.25%,计算一下需要过多少年,一万元的一年定期存款连本带息能翻番?