android如何实现快递跟踪进度条-创新互联
小编给大家分享一下android如何实现快递跟踪进度条,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
成都创新互联专注于青神网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供青神营销型网站建设,青神网站制作、青神网页设计、青神网站官网定制、重庆小程序开发服务,打造青神网络公司原创品牌,更为您提供青神网站排名全网营销落地服务。android快递跟踪进度条展示具体内容如下
activity.class
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.os.Bundle; import android.widget.ListView; public class MainActivity extends Activity { private ListView listView; Listdata; private TimelineAdapter timelineAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) this.findViewById(R.id.listview); listView.setDividerHeight(0); timelineAdapter = new TimelineAdapter(this, getData()); listView.setAdapter(timelineAdapter); } private List
适配器
import java.util.List; import java.util.Map; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class TimelineAdapter extends BaseAdapter { private List> list; private LayoutInflater inflater; public TimelineAdapter(Context context, List > list) { super(); this.inflater = LayoutInflater.from(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) { ViewHolder viewHolder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.listview_item, null); viewHolder = new ViewHolder(); viewHolder.time = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.title = (TextView) convertView.findViewById(R.id.title); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.time.setText(list.get(position).get("time").toString()); viewHolder.title.setText(list.get(position).get("title").toString()); return convertView; } static class ViewHolder { public TextView time; public TextView title; } }
布局文件
activity_main
listview_item
以上是“android如何实现快递跟踪进度条”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
文章题目:android如何实现快递跟踪进度条-创新互联
本文路径:http://ybzwz.com/article/dchhei.html