做项目的过程中有个需求需要时光轴,于是网上找了部分资料 ,写了个案例,现在分享给大家。

如图:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</RelativeLayout>
item.xml
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/item_timeline_time"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginTop="18dp"
android:gravity="center_horizontal"
android:padding="4dp"
android:textColor="@color/colorAccent"
android:textSize="16sp"
android:text="2015-06-08\n09:56"
/>
<RelativeLayout
android:id="@+id/item_timeline_icon_layout"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="4dp"
android:layout_marginRight="8dp"
android:layout_toRightOf="@id/item_timeline_time">
<com.timelinedemo.CircleImageView
android:id="@+id/item_timeline_icon_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@android:color/transparent"
app:civ_border_width="4dp" />
<ImageView
android:id="@+id/item_timeline_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:scaleType="fitCenter" />
</RelativeLayout>
<TextView
android:id="@+id/item_timeline_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_toRightOf="@id/item_timeline_icon_layout"
android:text="今日收入"
android:textColor="@color/colorPrimary"
android:textSize="15sp" />
<TextView
android:id="@+id/item_timeline_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item_timeline_content"
android:layout_marginTop="8dp"
android:layout_toRightOf="@id/item_timeline_icon_layout"
android:text="$ 100"
android:textColor="@color/colorPrimary"
android:textSize="22sp" />
<View
android:id="@+id/item_timeline_view"
android:layout_width="2dp"
android:layout_height="60dp"
android:layout_alignLeft="@id/item_timeline_icon_layout"
android:layout_below="@id/item_timeline_icon_layout"
android:layout_marginLeft="23dp"
android:background="@color/colorAccent" />
</RelativeLayout>
Activity.Java
public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initLayout();
}
private void initLayout(){
recyclerView= (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(new DefaultItemAnimator());
initData();
}
private void initData(){
List<TimeInfo > list=new ArrayList<>();
for(int i=0;i<15;i++){
list.add(new TimeInfo());
}
TimelineAdapter mAdapter = new TimelineAdapter(this, list);
recyclerView.setAdapter(mAdapter);
}
}
添加依赖库:
compile 'com.android.support:recyclerview-v7:23.0.0'
由于代码太多,完整代码未给出,源码直接下载即可
源码点击下载:TimeLineDemo_jb51.rar
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
# android时光轴效果
# android时光轴
# Android时光轴实现淘宝物流信息浏览效果
# Android自定义View实现垂直时间轴布局
# Android控件之使用ListView实现时间轴效果
# Android自定义view仿淘宝快递物流信息时间轴
# 教你3分钟了解Android 简易时间轴的实现方法
# Android自定义时间轴的实现过程
# Android实现列表时间轴
# Android TimeLine 时间节点轴的实现实例代码
# Android实现快递物流时间轴效果
# Android自定义recyclerView实现时光轴效果
# 太多
# 有个
# 给大家
# 找了
# 写了
# 点击下载
# 如图
# 大家多多
# 过程中
# 今日
# 网上
# paddingLeft
# wrap_content
# auto
# dp
# paddingTop
# paddingRight
# TextView
# RecyclerView
# id
相关文章:
网站建设设计制作营销公司南阳,如何策划设计和建设网站?
建站之星安装后如何自定义网站颜色与字体?
南平网站制作公司,2025年南平市事业单位报名时间?
如何通过宝塔面板实现本地网站访问?
如何选购建站域名与空间?自助平台全解析
建站之星好吗?新手能否轻松上手建站?
网站制作和推广的区别,想自己建立一个网站做推广,有什么快捷方法马上做好一个网站?
台州网站建设制作公司,浙江手机无犯罪记录证明怎么开?
制作网站的模板软件,网站怎么建设?
微信网站制作公司有哪些,民生银行办理公司开户怎么在微信网页上查询进度?
如何续费美橙建站之星域名及服务?
上海制作企业网站有哪些,上海有哪些网站可以让企业免费发布招聘信息?
建站之星安装路径如何正确选择及配置?
如何快速打造个性化非模板自助建站?
如何通过PHP快速构建高效问答网站功能?
高防网站服务器:DDoS防御与BGP线路的AI智能防护方案
胶州企业网站制作公司,青岛石头网络科技有限公司怎么样?
建站之星伪静态规则如何设置?
武汉外贸网站制作公司,现在武汉外贸前景怎么样啊?
建站之星2.7模板快速切换与批量管理功能操作指南
建站之星备案流程有哪些注意事项?
如何选择高效便捷的WAP商城建站系统?
贸易公司网站制作流程,出口贸易网站设计怎么做?
已有域名如何免费搭建网站?
建站org新手必看:2024最新搭建流程与模板选择技巧
微网站制作教程,不会写代码,不会编程,怎么样建自己的网站?
电脑免费海报制作网站推荐,招聘海报哪个网站多?
海南网站制作公司有哪些,海口网是哪家的?
自助网站制作软件,个人如何自助建网站?
如何基于云服务器快速搭建网站及云盘系统?
想学网站制作怎么学,建立一个网站要花费多少?
宁波自助建站系统如何快速打造专业企业网站?
大连网站制作公司哪家好一点,大连买房网站哪个好?
建站之星安装模板失败:服务器环境不兼容?
如何快速搭建高效简练网站?
如何在宝塔面板中修改默认建站目录?
建站主机选哪种环境更利于SEO优化?
如何使用Golang table-driven基准测试_多组数据测量函数效率
建站主机如何选?高性价比方案全解析
如何在局域网内绑定自建网站域名?
网站制作需要会哪些技术,建立一个网站要花费多少?
如何自定义建站之星网站的导航菜单样式?
在线流程图制作网站手机版,谁能推荐几个好的CG原画资源网站么?
制作网站怎么制作,*游戏网站怎么搭建?
深圳网站制作费用多少钱,读秀,深圳文献港这样的网站很多只提供网上试读,但有些人只要提供试读的文章就能全篇下载,这个是怎么弄的?
如何通过山东自助建站平台快速注册域名?
东莞专业网站制作公司有哪些,东莞招聘网站哪个好?
安徽网站建设与外贸建站服务专业定制方案
如何确保西部建站助手FTP传输的安全性?
建站之星展会模板:智能建站与自助搭建高效解决方案
*请认真填写需求信息,我们会在24小时内与您取得联系。