网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

Android中怎么实现一个简易时间轴

这期内容当中小编将会给大家带来有关Android中怎么实现一个简易时间轴,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

创新互联建站基于分布式IDC数据中心构建的平台为众多户提供光华机房服务器托管 四川大带宽租用 成都机柜租用 成都服务器租用。

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中怎么实现一个简易时间轴
文章来源:http://bjjierui.cn/article/ieejgi.html

其他资讯