亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android實現快遞物流時間軸效果

 更新時間:2018年05月16日 13:53:45   作者:willA書歡  
這篇文章主要為大家詳細介紹了Android實現快遞物流時間軸效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Android實現快遞物流時間軸效果展示的具體代碼,供大家參考,具體內容如下

首先,這篇參考了別人的代碼。根據自己的項目需求簡單改造了一下,效果圖如下

xml:代碼

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent" 
 android:orientation="vertical" > 
 
 <ListView 
  android:id="@+id/lv_list" 
  android:layout_width="match_parent" 
  android:layout_height="wrap_content" 
  android:cacheColorHint="@null" 
  android:divider="@null" > 
 </ListView> 
 
</LinearLayout> 

接下來是Activity,準備數據就好了

public class TimeLineTextActivity extends Activity{ 
  
 private ListView listView; 
 private TimeLineAdapter adapter; 
  
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
  // TODO Auto-generated method stub 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.activity_main); 
   
  listView=(ListView) findViewById(R.id.lv_list); 
  listView.setDividerHeight(0); 
  adapter = new TimeLineAdapter(this, initData()); 
  listView.setAdapter(adapter); 
   
 } 
 
 private List<Map<String, Object>> initData() { 
  List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); 
   
  Map<String, Object> map = new HashMap<String, Object>(); 
  map.put("title", "提交已完成......"); 
  map.put("time", "2015-10-22 14:00:00"); 
  list.add(map); 
   
  map = new HashMap<String, Object>(); 
  map.put("title", "正在審核中......"); 
  map.put("time", "2015-10-22 15:00:00"); 
  list.add(map); 
   
  map = new HashMap<String, Object>(); 
  map.put("title", "客服將會給您打電話......"); 
  map.put("time", "2015-10-22 16:00:00"); 
  list.add(map); 
   
  map = new HashMap<String, Object>(); 
  map.put("title", "訂單已完成"); 
  map.put("time", "2015-10-22 17:00:00"); 
  list.add(map); 
     
  return list; 
   
 } 
 
} 

Adapter:

public 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() { 
  // TODO Auto-generated method stub 
  return list.size(); 
 } 
 
 @Override 
 public Object getItem(int position) { 
  // TODO Auto-generated method stub 
  return position; 
 } 
 
 @Override 
 public long getItemId(int position) { 
  // TODO Auto-generated method stub 
  return position; 
 } 
 
 @Override 
 public View getView(int position, View convertView, ViewGroup parent) { 
  // TODO Auto-generated method stub 
  TimeLineHolder viewHolder = null; 
  if (convertView == null) { 
   inflater = LayoutInflater.from(parent.getContext()); 
   convertView = inflater.inflate(R.layout.itemtimeline2, null); 
   viewHolder = new TimeLineHolder(); 
 
   viewHolder.title = (TextView) convertView.findViewById(R.id.title); 
   viewHolder.time = (TextView) convertView.findViewById(R.id.time); 
   convertView.setTag(viewHolder); 
  } else { 
   viewHolder = (TimeLineHolder) convertView.getTag(); 
  } 
   
  String titleStr = list.get(position).get("title").toString(); 
   
  
  viewHolder.title.setText(titleStr); 
 
  return convertView; 
   
 } 
  
 static class TimeLineHolder{ 
  private TextView title,time; 
 } 
} 

每一個item的布局:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent" 
 android:orientation="vertical" > 
  
  <View 
  android:id="@+id/view_0" 
  android:layout_width="1dp" 
  android:layout_height="25dp" 
  android:layout_below="@+id/layout_1" 
  android:layout_marginLeft="40dp" 
  android:background="#A6A6A6" /> 
 <ImageView 
  android:id="@+id/image" 
  android:layout_width="15dp" 
  android:layout_height="15dp" 
  android:layout_below="@+id/view_0" 
  android:layout_marginLeft="33dp" 
  android:src="@drawable/timeline_green" /> 
 <View 
  android:id="@+id/view_2" 
  android:layout_width="1dp" 
  android:layout_height="50dp" 
  android:layout_below="@+id/image" 
  android:layout_marginLeft="40dp" 
  android:background="#A6A6A6" /> 
  
 <View 
  android:id="@+id/view_4" 
  android:layout_width="match_parent" 
  android:layout_height="1dp" 
  android:layout_alignBottom="@+id/view_2" 
  android:layout_marginLeft="55dp" 
  android:layout_marginRight="15dp" 
  android:background="#A6A6A6" /> 
  
  <RelativeLayout 
  android:id="@+id/relative" 
  android:layout_width="fill_parent" 
  android:layout_height="match_parent" 
  android:layout_margin="10dp" 
  android:layout_toRightOf="@+id/view_0" 
  android:layout_alignBottom="@+id/view_4" 
  android:padding="5dp" 
  android:orientation="vertical" > 
 
  <TextView 
   android:id="@+id/title" 
   android:layout_width="match_parent" 
   android:layout_height="wrap_content" 
   android:ellipsize="end" 
   android:layout_marginTop="8dp" 
   android:maxEms="7" 
   android:paddingLeft="5dp" 
   android:singleLine="true" 
   android:text="需求提交成功" 
   android:textSize="16sp" /> 
  <TextView 
   android:id="@+id/time" 
   android:layout_width="match_parent" 
   android:layout_height="wrap_content" 
   android:ellipsize="end" 
   android:layout_below="@+id/title" 
   android:layout_marginTop="15dp" 
   android:maxEms="7" 
   android:paddingLeft="5dp" 
   android:singleLine="true" 
   android:text="2015-9-28" 
   android:textSize="14sp" /> 
 
 </RelativeLayout> 
 
</RelativeLayout> 

其實這個東西看起來復雜,實際上挺簡單的,就是一個ListView,希望對大家有幫助!

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • Flutter實現簡單的下載按鈕動畫

    Flutter實現簡單的下載按鈕動畫

    我們在app的開發(fā)過程中經常會用到一些表示進度類的動畫效果,比如一個下載按鈕,那么在flutter中一個下載按鈕的動畫應該如何制作呢,一起來看看吧
    2023-05-05
  • Android SoundPool實現簡短小音效

    Android SoundPool實現簡短小音效

    這篇文章主要為大家詳細介紹了Android SoundPool實現簡短小音效,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-11-11
  • Flutter學習之實現自定義themes詳解

    Flutter學習之實現自定義themes詳解

    一般情況下我們在flutter中搭建的app基本上都是用的是MaterialApp這種設計模式,MaterialApp中為我們接下來使用的按鈕,菜單等提供了統(tǒng)一的樣式,那么這種樣式能不能進行修改或者自定義呢?答案是肯定的,一起來看看吧
    2023-03-03
  • Android 照相機的實例應用

    Android 照相機的實例應用

    這篇文章主要介紹了Android 照相機的實例應用的相關資料,希望通過此文能掌握Android照相機的使用方法,需要的朋友可以參考下
    2017-08-08
  • android?原生安全音量配置邏輯設計詳解

    android?原生安全音量配置邏輯設計詳解

    這篇文章主要為大家介紹了android?原生安全音量配置邏輯設計詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-01-01
  • Android中TelephonyManager類的方法實例分析

    Android中TelephonyManager類的方法實例分析

    這篇文章主要介紹了Android中TelephonyManager類的方法,以實例形式較為詳細的分析了Android基于TelephonyManager類獲取手機各種常用信息的相關技巧,需要的朋友可以參考下
    2015-09-09
  • 詳解 WebView 與 JS 交互傳值問題

    詳解 WebView 與 JS 交互傳值問題

    這篇文章主要介紹了詳解 WebView 與 JS 交互傳值問題的相關資料,需要的朋友可以參考下
    2017-06-06
  • Android指紋識別功能深入淺出分析到實戰(zhàn)(6.0以下系統(tǒng)解決方案)

    Android指紋識別功能深入淺出分析到實戰(zhàn)(6.0以下系統(tǒng)解決方案)

    指紋識別在現實應用中已經很多了,本篇文章主要介紹了Android指紋識別功能,具有一定的參考價值,有需要的可以了解一下。
    2016-11-11
  • Android客戶端實現注冊、登錄詳解(2)

    Android客戶端實現注冊、登錄詳解(2)

    這篇文章主要為大家詳細介紹了Android客戶端實現注冊、登錄代碼第二篇,App與服務器的交互實現登錄和自動登錄功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-11-11
  • Kotlin自定義View系列教程之標尺控件(選擇身高、體重等)的實現

    Kotlin自定義View系列教程之標尺控件(選擇身高、體重等)的實現

    這篇文章主要給大家介紹了關于Kotlin自定義View系列教程之標尺控件(選擇身高、體重等)實現的相關資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考借鑒,下面隨著小編來一起學習學習吧
    2018-07-07

最新評論