欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android應(yīng)用中怎么實(shí)現(xiàn)一個(gè)跟蹤布局效果

這篇文章給大家介紹Android應(yīng)用中怎么實(shí)現(xiàn)一個(gè)跟蹤布局效果,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

我們提供的服務(wù)有:網(wǎng)站制作、成都做網(wǎng)站、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、嵊州ssl等。為上1000家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的嵊州網(wǎng)站制作公司

首頁Activity

public class TraceActivity extends AppCompatActivity {

  private ListView lvTrace;
  private List<Trace> traceList = new ArrayList<>(10);
  private TraceListAdapter adapter;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_trace);
    findView();
    initData();
  }

  private void findView() {
    lvTrace = (ListView) findViewById(R.id.lvTrace);
  }

  private void initData() {
    // 模擬一些假的數(shù)據(jù)
    traceList.add(new Trace("2016年11月18日 上午12:04:01", "在湖北武漢洪山區(qū)光谷公司長(zhǎng)江社區(qū)便民服務(wù)站進(jìn)行簽收掃描,快件已被 已簽收 簽收"));
    traceList.add(new Trace("2016年11月18日 上午11:57:25", "在湖北武漢洪山區(qū)光谷公司長(zhǎng)江社區(qū)便民服務(wù)站進(jìn)行派件掃描;派送業(yè)務(wù)員:老王;聯(lián)系電話:17786550311"));
    traceList.add(new Trace("2016年11月17日 下午4:43:29", "在湖北武漢洪山區(qū)光谷公司進(jìn)行快件掃描,將發(fā)往:湖北武漢洪山區(qū)光谷公司長(zhǎng)江社區(qū)便民服務(wù)站"));
    traceList.add(new Trace("2016年11月17日 上午9:11:21", "從湖北武漢分撥中心發(fā)出,本次轉(zhuǎn)運(yùn)目的地:湖北武漢洪山區(qū)光谷公司"));
    traceList.add(new Trace("2016年11月17日 上午1:53:14", "在湖南長(zhǎng)沙分撥中心進(jìn)行裝車掃描,即將發(fā)往:湖北武漢分撥中心"));
    traceList.add(new Trace("2016年11月17日 上午1:50:18", "在分撥中心湖南長(zhǎng)沙分撥中心進(jìn)行稱重掃描"));
    traceList.add(new Trace("2016年11月16日 上午11:27:58", "在湖南隆回縣公司進(jìn)行到件掃描"));
    adapter = new TraceListAdapter(this, traceList);
    lvTrace.setAdapter(adapter);
  }
}

然后適配器

public class TraceListAdapter extends BaseAdapter {
  private Context context;
  private List<Trace> traceList = new ArrayList<>(1);
  private static final int TYPE_TOP = 0x0000;
  private static final int TYPE_NORMAL= 0x0001;

  public TraceListAdapter(Context context, List<Trace> traceList) {
    this.context = context;
    this.traceList = traceList;
  }

  @Override
  public int getCount() {
    return traceList.size();
  }

  @Override
  public Trace getItem(int position) {
    return traceList.get(position);
  }

  @Override
  public long getItemId(int position) {
    return position;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    final Trace trace = getItem(position);
    if (convertView != null) {
      holder = (ViewHolder) convertView.getTag();
    } else {
      holder = new ViewHolder();
      convertView = LayoutInflater.from(context).inflate(R.layout.item_trace, parent, false);
      holder.tvAcceptTime = (TextView) convertView.findViewById(R.id.tvAcceptTime);
      holder.tvAcceptStation = (TextView) convertView.findViewById(R.id.tvAcceptStation);
      holder.tvTopLine = (TextView) convertView.findViewById(R.id.tvTopLine);
      holder.tvDot = (TextView) convertView.findViewById(R.id.tvDot);
      holder.tv_new = (TextView) convertView.findViewById(R.id.tv_new);
      convertView.setTag(holder);
    }

    if (getItemViewType(position) == TYPE_TOP) {
      // 第一行頭的豎線不顯示
      holder.tvTopLine.setVisibility(View.INVISIBLE);
      holder.tv_new.setVisibility(View.VISIBLE);
      // 字體顏色加深
      holder.tvAcceptTime.setTextColor(context.getResources().getColor(R.color.red));
      holder.tvAcceptStation.setTextColor(context.getResources().getColor(R.color.red));
      holder.tvDot.setBackgroundResource(R.drawable.timelline_dot_secord);
    } else if (getItemViewType(position) == TYPE_NORMAL) {
      holder.tvTopLine.setVisibility(View.VISIBLE);
      holder.tv_new.setVisibility(View.INVISIBLE);
      holder.tvAcceptTime.setTextColor(0xff999999);
      holder.tvAcceptStation.setTextColor(0xff999999);
      holder.tvDot.setBackgroundResource(R.drawable.timelline_dot_first);
    }

    holder.tvAcceptTime.setText(trace.getAcceptTime());
    holder.tvAcceptStation.setText(trace.getAcceptStation());
    return convertView;
  }

  @Override
  public int getItemViewType(int id) {
    if (id == 0) {
      return TYPE_TOP;
    }
    return TYPE_NORMAL;
  }

  static class ViewHolder {
    public TextView tvAcceptTime, tvAcceptStation;
    public TextView tvTopLine, tvDot,tv_new;
  }
}

實(shí)體類

public class Trace {
  /** 時(shí)間 */
  private String acceptTime;
  /** 描述 */
  private String acceptStation;

  public Trace() {
  }

  public Trace(String acceptTime, String acceptStation) {
    this.acceptTime = acceptTime;
    this.acceptStation = acceptStation;
  }

  public String getAcceptTime() {
    return acceptTime;
  }

  public void setAcceptTime(String acceptTime) {
    this.acceptTime = acceptTime;
  }

  public String getAcceptStation() {
    return acceptStation;
  }

  public void setAcceptStation(String acceptStation) {
    this.acceptStation = acceptStation;
  }
}

activity布局和item布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:background="@android:color/white"
  tools:context="cc.duduhuo.timelinedemo.TraceActivity">

  <ListView
    android:id="@+id/lvTrace"
    android:layout_width="match_parent"
    android:divider="@null"
    android:clickable="false"
    android:listSelector="@android:color/transparent"
    android:dividerHeight="0dp"
    android:layout_height="wrap_content" />
</LinearLayout>
<&#63;xml version="1.0" encoding="utf-8"&#63;>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="center"
  android:orientation="horizontal">

  <RelativeLayout
    android:id="@+id/rlTimeline"
    android:layout_width="75dp"
    android:layout_height="match_parent">

    <TextView
      android:id="@+id/tvTopLine"
      android:layout_width="0.5dp"
      android:layout_height="12dp"
      android:layout_centerHorizontal="true"
      android:background="#999" />

    <TextView
      android:id="@+id/tvDot"
      android:layout_width="5dp"
      android:layout_height="5dp"
      android:layout_margin="2dp"
      android:layout_below="@id/tvTopLine"
      android:layout_centerHorizontal="true"
      android:background="@drawable/timelline_dot_normal" />

    <TextView
      android:layout_width="0.5dp"
      android:layout_height="match_parent"
      android:layout_below="@id/tvDot"
      android:layout_centerHorizontal="true"
      android:background="#999" />
    <TextView
      android:id="@+id/tv_new"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="最新"
      android:textColor="#ffffff"
      android:background="#ff0000"
      android:textSize="12sp"
      android:layout_marginLeft="3dp"
      android:paddingLeft="3dp"
      android:paddingRight="3dp"
      android:layout_toRightOf="@id/tvDot"
      android:layout_below="@id/tvTopLine"
      />
  </RelativeLayout>

  <RelativeLayout
    android:id="@+id/rlCenter"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="6dp"
    android:paddingRight="10dp"
    android:paddingLeft="10dp"
    android:paddingTop="6dp">

    <TextView
      android:id="@+id/tvAcceptTime"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="2014/06/24 20:55:28"
      android:textColor="#999"
      android:textSize="12sp" />

    <TextView
      android:id="@+id/tvAcceptStation"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@id/tvAcceptTime"
      android:layout_marginTop="5dp"
      android:text="在湖南隆回縣公司進(jìn)行到件掃描"
      android:textColor="#999"
      android:textSize="12sp" />
  </RelativeLayout>
</LinearLayout>

關(guān)于Android應(yīng)用中怎么實(shí)現(xiàn)一個(gè)跟蹤布局效果就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

分享標(biāo)題:Android應(yīng)用中怎么實(shí)現(xiàn)一個(gè)跟蹤布局效果
本文來源:http://chinadenli.net/article38/joegsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)服務(wù)器托管、建站公司企業(yè)網(wǎng)站制作、商城網(wǎng)站自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)
熟女乱一区二区三区丝袜| 日本人妻熟女一区二区三区 | 国产精品亚洲一级av第二区| 国产在线一区二区三区不卡| 九九热在线免费在线观看| 国产欧美日本在线播放| 丝袜诱惑一区二区三区| 99国产成人免费一区二区| 精品欧美在线观看国产| 欧美尤物在线视频91| 欧美大粗爽一区二区三区| 日韩中文字幕狠狠人妻| 亚洲av秘片一区二区三区| 91久久国产福利自产拍| 亚洲高清欧美中文字幕| 日韩性生活片免费观看| 国产又粗又黄又爽又硬的| 亚洲性日韩精品一区二区| 国产麻豆精品福利在线| 国产精品不卡高清在线观看| 熟女体下毛荫荫黑森林自拍| 久久久精品日韩欧美丰满| 欧美一区二区三区性视频| 久久一区内射污污内射亚洲| 在线观看日韩欧美综合黄片| 黄男女激情一区二区三区| 国内外激情免费在线视频| 熟女一区二区三区国产| 日本在线不卡高清欧美| 日韩欧美一区二区不卡看片| 欧美成人国产精品高清| 久久99这里只精品热在线| 男人和女人干逼的视频| 真实偷拍一区二区免费视频| 精品午夜福利无人区乱码| 激情图日韩精品中文字幕| 亚洲欧洲一区二区中文字幕| 91老熟妇嗷嗷叫太91| 亚洲综合天堂一二三区| 亚洲人午夜精品射精日韩| 日本男人女人干逼视频|