Android中如何实现一个简易时间轴
发表于:2026-11-04 作者:千家信息网编辑
千家信息网最后更新 2026年11月04日,这篇文章主要讲解了"Android中如何实现一个简易时间轴",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Android中如何实现一个简易时间轴"吧!1
千家信息网最后更新 2026年11月04日Android中如何实现一个简易时间轴
这篇文章主要讲解了"Android中如何实现一个简易时间轴",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Android中如何实现一个简易时间轴"吧!
1.新建一个自定义控件:
public class WorkExcView extends LinearLayout {private TextView dataLeft;private TextView dataRight;private TextView company;private TextView job;private TextView jobAsses;private TextView xiTong;private TextView ziTian;private LinearLayout jobContentContainer;private TextView jobContent;private LinearLayout commentContainer;private LinearLayout nianContentContainer;private TextView nianContent;private LinearLayout base;private LinearLayout yueXingContainer;private TextView yueContent;private LinearLayout nianXingContainer;private TextView yueMoreContent;private TextView nianMoreContent;private String company_id;public WorkExcView(Context context) { this(context,null);}public WorkExcView(Context context, AttributeSet attrs) { super(context, attrs); init();}private void init() { View inflate = View.inflate(getContext(), R.layout.activity_four_workexcview, this); dataLeft = (TextView) inflate.findViewById(R.id.workexcview_data_left); dataRight= (TextView) inflate.findViewById(R.id.workexcview_data_right); company = (TextView) inflate.findViewById(R.id.workexcview_company); job = (TextView) inflate.findViewById(R.id.workexcview_job); jobAsses = (TextView) inflate.findViewById(R.id.workexcview__job_asses); xiTong = (TextView) inflate.findViewById(R.id.workexcview_xitong); ziTian = (TextView) inflate.findViewById(R.id.workexcview_zitian); jobContent = (TextView) inflate.findViewById(R.id.workexcview_jobcontent); nianContent = (TextView) inflate.findViewById(R.id.workexcview_niancontent); jobContentContainer = (LinearLayout)inflate.findViewById(R.id.workexcview_jobcontent_container); commentContainer = (LinearLayout)inflate.findViewById(R.id.workexcview__comment_container); nianContentContainer= (LinearLayout)inflate.findViewById(R.id.workexcview__niancontent_container); base = (LinearLayout)inflate.findViewById(R.id.workexcview__base); yueXingContainer = (LinearLayout)inflate.findViewById(R.id.workexcview_yuexing_container); yueContent = (TextView)inflate.findViewById(R.id.workexcview_yuecontent); nianXingContainer = (LinearLayout)inflate.findViewById(R.id.workexcview_nianxing_container); yueMoreContent = (TextView)inflate.findViewById(R.id.workexcview_yuecontentmore); nianMoreContent = (TextView)inflate.findViewById(R.id.workexcview_niancontentmore);}public void initData(final FourBean.JobsBean jobsBean) { //赋值代码}XML文件:
2.使用方式:其实很简单,直接for循环new出来赋值就行啦,因为本身就是一个自定义控件~
fourWorkexcContainer.removeAllViews(); for (int i = 0; i < jobs.size(); i++) { FourBean.JobsBean jobsBean = jobs.get(i); WorkExcView workExcView = new WorkExcView(getContext()); workExcView.initData(jobsBean); fourWorkexcContainer.addView(workExcView); }感谢各位的阅读,以上就是"Android中如何实现一个简易时间轴"的内容了,经过本文的学习后,相信大家对Android中如何实现一个简易时间轴这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!
时间
简易
学习
内容
就是
控件
代码
思路
情况
文件
文章
方式
更多
知识
知识点
篇文章
跟着
问题
实践
循环
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网科技公司简介
华服互联网科技怎么样
深圳恒合互联网络科技有限公司
科技互联网政务服务
科技与互联网发展
中国 科技 互联网
互联网科技论文
广州紫鲸互联网科技
盛创互联网科技有限公司
深圳互联网科技怎么样
南平创想时代互联网科技有限公司
崇明区互联网教育科技售后服务
济南有互联网科技公司吗
云南省自由互联网科技有限公司
科技和互联网行业的特点
马化腾互联网科技教学
玉溪新华互联网科技怎么选
互联网的黑科技实验室
利用互联网等科技手段
互联网科技企业文化
互联网科技名片
广州为想互联网科技有限公司
互联网科技保险
互联网核心科技是什么
青岛互联网科技公司
互联网科技公司需要的职位
35岁以上互联网科技行业
互联网科技包装股份有限公司上市
互联网科技和医药行业
小牛互联网科技有限公司地址