<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > Android常用控件之下拉刷新Wifi列表

          Android常用控件之下拉刷新Wifi列表

          作者: 時間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

          headView.setPadding(0, 0, 0, 0);

          progressBar.setVisibility(View.VISIBLE);

          arrowImageView.clearAnimation();

          arrowImageView.setVisibility(View.GONE);

          tipsTextview.setText(正在刷新...);

          lastUpdatedTextView.setVisibility(View.VISIBLE);

          Log.v(TAG, 當(dāng)前狀態(tài),正在刷新...);

          break;

          case DONE:

          headView.setPadding(0, -1 * headContentHeight, 0, 0);

          progressBar.setVisibility(View.GONE);

          arrowImageView.clearAnimation();

          arrowImageView.setImageResource(R.drawable.arrow);

          tipsTextview.setText(下拉刷新);

          lastUpdatedTextView.setVisibility(View.VISIBLE);

          Log.v(TAG, 當(dāng)前狀態(tài),done);

          break;

          }

          }

          public void setonRefreshListener(OnRefreshListener refreshListener) {

          this.refreshListener = refreshListener;

          isRefreshable = true;

          }

          public interface OnRefreshListener {

          public void onRefresh();

          }

          public void onRefreshComplete() {

          state = DONE;

          SimpleDateFormat sdf = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);

          lastUpdatedTextView.setText(最近更新: + sdf.format(new Date()));

          changeHeaderViewByState();

          }

          private void onRefresh() {

          if (refreshListener != null) {

          refreshListener.onRefresh();

          }

          }

          /**

          * 此方法直接照搬自網(wǎng)絡(luò)上的一個下拉刷新的demo,此處是“估計”headView的width以及height

          * @param child

          */

          private void measureView(View child) {

          ViewGroup.LayoutParams p = child.getLayoutParams();

          if (p == null) {

          p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,

          ViewGroup.LayoutParams.WRAP_CONTENT);

          }

          int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width);

          int lpHeight = p.height;

          int childHeightSpec;

          if (lpHeight > 0) {

          childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight,

          MeasureSpec.EXACTLY);

          } else {

          childHeightSpec = MeasureSpec.makeMeasureSpec(0,

          MeasureSpec.UNSPECIFIED);

          }

          child.measure(childWidthSpec, childHeightSpec);

          }

          public void setAdapter(BaseAdapter adapter) {

          SimpleDateFormat sdf = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);

          lastUpdatedTextView.setText(最近更新: + sdf.format(new Date()));

          super.setAdapter(adapter);

          }

          }

          main.xml

          下拉列表松開后需要掃描Wifi,再刷新列表

          106package com.example.dropdownrefresh;

          import java.util.ArrayList;

          import java.util.HashMap;

          import java.util.List;

          import android.app.Activity;

          import android.net.wifi.ScanResult;

          import android.os.AsyncTask;

          import android.os.Bundle;

          import android.view.View;

          import android.view.ViewGroup;



          關(guān)鍵詞:

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();