当前位置:网站首页>Timeline and logistics information. You don't need stepview at all
Timeline and logistics information. You don't need stepview at all
2022-06-10 13:04:00 【yechaoa】
design sketch :
The code is simple , It's not too difficult
MainActivity.java
package com.yechaoa.timelinedemo;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
private ListView mListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initData();
}
private void initView() {
mListView = (ListView) findViewById(R.id.listView);
}
private void initData() {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("title", " Signed for Looking forward to serving you again ");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
map = new HashMap<>();
map.put("title", " In the process of dispatch Courier ** 123456789");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
map = new HashMap<>();
map.put("title", " The express has arrived Shanghai Pudong distribution center ");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
map = new HashMap<>();
map.put("title", " The express has arrived Shanghai Hongqiao distribution center ");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
map = new HashMap<>();
map.put("title", " Suzhou Wujiang key customer business department Already issued ");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
map = new HashMap<>();
map.put("title", " The package is waiting for collection ");
map.put("time", "2017-08-14 11:21:58");
list.add(map);
mListView.setAdapter(new TimeLineAdapter(this, list));
}
class TimeLineAdapter extends BaseAdapter {
private Context context;
private List<Map<String, Object>> list;
private LayoutInflater inflater;
public TimeLineAdapter(Context context, List<Map<String, Object>> list) {
super();
this.context = context;
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TimeLineHolder viewHolder;
if (convertView == null) {
inflater = LayoutInflater.from(parent.getContext());
convertView = inflater.inflate(R.layout.item_time_line, null);
viewHolder = new TimeLineHolder();
viewHolder.title = (TextView) convertView.findViewById(R.id.title);
viewHolder.time = (TextView) convertView.findViewById(R.id.time);
viewHolder.view0 = convertView.findViewById(R.id.view0);
viewHolder.view4 = convertView.findViewById(R.id.view4);
viewHolder.image = (ImageView) convertView.findViewById(R.id.image);
convertView.setTag(viewHolder);
} else {
viewHolder = (TimeLineHolder) convertView.getTag();
}
// according to key obtain value
String titleStr = list.get(position).get("title").toString();
viewHolder.title.setText(titleStr);
String timeStr = list.get(position).get("time").toString();
viewHolder.time.setText(timeStr);
// First remove the vertical line above , And set the color
if (position == 0) {
viewHolder.title.setTextColor(ContextCompat.getColor(context, R.color.colorPrimary));
viewHolder.time.setTextColor(ContextCompat.getColor(context, R.color.colorPrimary));
viewHolder.image.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.shape_oval_primary));
viewHolder.view0.setVisibility(View.INVISIBLE);
} else {
viewHolder.title.setTextColor(Color.GRAY);
viewHolder.time.setTextColor(Color.GRAY);
}
// The last one removes the underline at the bottom
if (position == list.size() - 1) {
viewHolder.view4.setVisibility(View.INVISIBLE);
} else {
viewHolder.view4.setVisibility(View.VISIBLE);
}
return convertView;
}
class TimeLineHolder {
private TextView title, time;
private View view0, view4;
private ImageView image;
}
}
}complete Demo:https://github.com/yechaoa/TimeLineDemo
边栏推荐
- JS global timer case
- SparkStreaming实时数仓 问题&回答
- Stereo vision based semantic 3D object and ego motion tracking for automotive driving
- VDMA调试总结
- 深度神经网络每秒分类近20亿张图像,新型类脑光学分类器芯片登上Nature
- Find the number of common subsequences of K strings
- 施一公等团队登Science封面:AI与冷冻电镜揭示「原子级」NPC结构,生命科学突破
- Office technical lecture: punctuation - Chinese - vertical
- VDO-SLAM源码阅读笔记[2] local optimization和global optimization
- MySQL数据库(26):视图 view
猜你喜欢

蚂蚁金服杨军:蚂蚁数据分析平台的演进及数据分析方法的应用

20-year technical veteran gives up his CTO title! Why did the startup attract him?

Which EDA design software should Altium Allegro pads choose

CVPR2022|AConvNetforthe2020s&如何设计神经网络总结
![VDO-SLAM源码阅读笔记[2] local optimization和global optimization](/img/01/7ce7113737d9799ac2684788d9f08d.jpg)
VDO-SLAM源码阅读笔记[2] local optimization和global optimization

JS translates Arabic numerals into Chinese capital figures, JS converts figures into capital amounts (sorting)

Recommended learning materials for Altium Designer

Summary of Kitti related information

QT database application 22 file coding format recognition

KITTI 相关信息汇总
随机推荐
Introduction of Altium Designer
list. Remove (index) returns false, removal failed
colmap源码阅读笔记[1] threading.cc
谷歌提出超强预训练模型CoCa,在ImageNet上微调Top-1准确率达91%!在多个下游任务上SOTA!
UML class diagram
用GNN做CV三大任务的新骨干,同计算成本性能不输CNN、ViT与MLP|中科院&华为诺亚开源...
Software project management 6.10 Cost budget
JS prohibit copying page content
[raise bar C #] how to call the base of the interface
Baidu programmers were sentenced to nine months for deleting the database. The one click unbinding function of the mobile phone number was released. Twitter compromised with musk again. Today, more bi
VDO-SLAM源码阅读笔记[1] Track()中动态obj部分
实战案例,深入剖析
MYSQL 主库操作大表DDL ,从库崩溃与系统参数错误设置
如何才能把团队给带解散。。。
VDO-SLAM源码阅读笔记[2] local optimization和global optimization
今天,一对情侣拿下香港最大电商IPO
Case sharing and implementation introduction of SAP field service management and wechat integration
Can qiniu open an account? Can qiniu directly open the security of securities companies on the app
技术分享| 快对讲,全球对讲
WTO MC12 restart agenda focuses on global economic recovery