小編給大家分享一下android如何實(shí)現(xiàn)快遞跟蹤進(jìn)度條,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都創(chuàng)新互聯(lián)專注于青神網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供青神營銷型網(wǎng)站建設(shè),青神網(wǎng)站制作、青神網(wǎng)頁設(shè)計(jì)、青神網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造青神網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供青神網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。android快遞跟蹤進(jìn)度條展示具體內(nèi)容如下
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如何實(shí)現(xiàn)快遞跟蹤進(jìn)度條”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!