當前位置: 首頁>>代碼示例>>Java>>正文


Java ListView.setOnScrollListener方法代碼示例

本文整理匯總了Java中android.widget.ListView.setOnScrollListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.setOnScrollListener方法的具體用法?Java ListView.setOnScrollListener怎麽用?Java ListView.setOnScrollListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ListView的用法示例。


在下文中一共展示了ListView.setOnScrollListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import android.widget.ListView; //導入方法依賴的package包/類
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
  final SampleListDetailActivity activity = (SampleListDetailActivity) getActivity();
  final SampleListDetailAdapter adapter = new SampleListDetailAdapter(activity);

  ListView listView = (ListView) LayoutInflater.from(activity)
      .inflate(R.layout.sample_list_detail_list, container, false);
  listView.setAdapter(adapter);
  listView.setOnScrollListener(new SampleScrollListener(activity));
  listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
      String url = adapter.getItem(position);
      activity.showDetails(url);
    }
  });
  return listView;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:SampleListDetailActivity.java

示例2: initWidgets

import android.widget.ListView; //導入方法依賴的package包/類
@Override
protected void initWidgets() {
    super.initWidgets();
    mLayoutBottom = (RelativeLayout) findViewById(R.id.kf5_bottom_layout);
    mFeedBackDetailBottomView = new FeedBackDetailBottomView(mActivity);
    mFeedBackDetailBottomView.setListener(this);
    mETContent = layoutListener.getEditText();
    mLayoutBottom.addView(mFeedBackDetailBottomView);
    mListView = (ListView) findViewById(R.id.kf5_activity_feed_back_details_listview);
    mListView.setOnScrollListener(this);
    mListView.setOnItemLongClickListener(this);
    mListView.addHeaderView(inflateHeaderView());
    mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImg.setOnClickListener(this);
    mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
    mRightView.setOnClickListener(this);
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:18,代碼來源:FeedBackDetailsActivity.java

示例3: addScrollListener

import android.widget.ListView; //導入方法依賴的package包/類
public static void addScrollListener(ListView listview, OnScrollListener listener){
    if (listview == null || listener == null)  {
        return;
    }
    OnScrollListener originListener = getScrollListenerFromListView(listview);
    if (originListener instanceof MultiScrollListener) {
        (((MultiScrollListener)originListener)).addListener(listener);
    } else {
        MultiScrollListener multiScrollListener = new MultiScrollListener();
        if (originListener != null) {
            multiScrollListener.addListener(originListener);
        }
        multiScrollListener.addListener(listener);
        listview.setOnScrollListener(multiScrollListener);
    }
}
 
開發者ID:liyuanhust,項目名稱:LoadMoreHelper,代碼行數:17,代碼來源:MultiScrollListener.java

示例4: removeScrollListener

import android.widget.ListView; //導入方法依賴的package包/類
public static void removeScrollListener(ListView listview, OnScrollListener listener) {
    if (listview == null || listener == null) {
        return;
    }
    OnScrollListener originListener = getScrollListenerFromListView(listview);
    if (originListener == listener) {
        listview.setOnScrollListener(null);
    } else {
        if (originListener instanceof MultiScrollListener) {
            MultiScrollListener multiScrollListener = (MultiScrollListener)originListener;
            multiScrollListener.removeListener(listener);
            if (multiScrollListener.isEmpty()) {
                listview.setOnScrollListener(null);
            }
        }
    }
}
 
開發者ID:liyuanhust,項目名稱:LoadMoreHelper,代碼行數:18,代碼來源:MultiScrollListener.java

示例5: initRes

import android.widget.ListView; //導入方法依賴的package包/類
/**
 * @Description 初始化界麵資源
 */
private void initRes() {
    // 設置頂部標題欄
    showContactTopBar();
    hideTopBar();

    super.init(curView);
    showProgressBar();

    sortSideBar = (SortSideBar) curView.findViewById(R.id.sidrbar);
    dialog = (TextView) curView.findViewById(R.id.dialog);
    sortSideBar.setTextView(dialog);
    sortSideBar.setOnTouchingLetterChangedListener(this);

    allContactListView = (ListView) curView.findViewById(R.id.all_contact_list);
    departmentContactListView = (ListView) curView.findViewById(R.id.department_contact_list);

    //this is critical, disable loading when finger sliding, otherwise you'll find sliding is not very smooth
    allContactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true));
    departmentContactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true));
    // todo eric
    // showLoadingProgressBar(true);
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:26,代碼來源:ContactFragment.java

示例6: getListView

import android.widget.ListView; //導入方法依賴的package包/類
/**
 * 獲取ListView對象
 */
private void getListView() {
    int childs = getChildCount();
    if (childs > 0) {
        View childView = getChildAt(0);
       if (childView instanceof ListView) {
            mInternalListView = (ListView) childView;
            // 設置滾動監聽器給ListView, 使得滾動的情況下也可以自動加載
            mInternalListView.setOnScrollListener(this);
            Log.d("zttjiangqq","存在listview...");
        }else{
            Log.d("zttjiangqq","不存在listview...");
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:CustomSwipeRefreshLayout.java

示例7: onCreate

import android.widget.ListView; //導入方法依賴的package包/類
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.sample_contacts_activity);

  adapter = new SampleContactsAdapter(this);

  ListView lv = (ListView) findViewById(android.R.id.list);
  lv.setAdapter(adapter);
  lv.setOnScrollListener(new SampleScrollListener(this));

  getSupportLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, this);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:SampleContactsActivity.java

示例8: setResult

import android.widget.ListView; //導入方法依賴的package包/類
public void setResult(List<Connection> result) {
    if(connections == null) {
        connections = result;
    } else {
        connections.addAll(result);
    }
    if(adapter == null) {
        ListView listView = (ListView)findViewById(R.id.result_list);
        adapter = new ConnectionAdapter(this, result);
        listView.setAdapter(adapter);
        listView.setOnScrollListener(new SearchResultScrollListener(this, query));
    } else {
        adapter.notifyDataSetChanged();
    }
}
 
開發者ID:IMSmobile,項目名稱:Fahrplan,代碼行數:16,代碼來源:SearchResultActivity.java

示例9: getListView

import android.widget.ListView; //導入方法依賴的package包/類
private void getListView() {
    int childCount = getChildCount();
    if (childCount > 0) {
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
            if (child instanceof ListView) {
                mListView = (ListView) child;
                // 設置滾動監聽器給ListView, 使得滾動到底部可以自動加載
                mListView.setOnScrollListener(onScrollListener);
                break;
            }
        }
    }
}
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:15,代碼來源:PullToRefreshSwipeLayout.java

示例10: setupListView

import android.widget.ListView; //導入方法依賴的package包/類
private void setupListView() {
    mListView = (ListView) findViewById(R.id.list);

    mPackageList = new ArrayList<>();
    mPackageAdapter = new PackageItemAdapter(this, mPackageList);
    mListView.setAdapter(mPackageAdapter);
    mListView.setHeaderDividersEnabled(false);

    mListView.setOnScrollListener(this); // not show fast scroll always
    mListView.setOnItemClickListener(this);
}
 
開發者ID:mthli,項目名稱:Mount,代碼行數:12,代碼來源:MountActivity.java

示例11: setupTableDataView

import android.widget.ListView; //導入方法依賴的package包/類
private void setupTableDataView(final AttributeSet attributes, final int styleAttributes) {
    final LayoutParams dataViewLayoutParams = new LayoutParams(getWidthAttribute(attributes), LayoutParams.MATCH_PARENT);

    if (isInEditMode()) {
        tableDataAdapter = new EditModeTableDataAdapter(getContext());
    } else {
        tableDataAdapter = new DefaultTableDataAdapter(getContext());
    }
    tableDataAdapter.setRowBackgroundProvider(dataRowBackgroundProvider);

    tableDataView = new ListView(getContext(), attributes, styleAttributes);

    tableDataView.setOnItemClickListener(new InternalDataClickListener());
    tableDataView.setOnItemLongClickListener(new InternalDataLongClickListener());
    tableDataView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    tableDataView.setAdapter(tableDataAdapter);
    tableDataView.setId(R.id.table_data_view);
    tableDataView.setOnScrollListener(new InternalOnScrollListener());

    swipeRefreshLayout = new SwipeRefreshLayout(getContext());
    swipeRefreshLayout.setLayoutParams(dataViewLayoutParams);
    swipeRefreshLayout.addView(tableDataView);
    swipeRefreshLayout.setColorSchemeColors(headerColor);
    swipeRefreshLayout.setEnabled(false);

    addView(swipeRefreshLayout);
}
 
開發者ID:datalink747,項目名稱:Sortable_tableview_soussidev,代碼行數:28,代碼來源:TableView.java

示例12: initViews

import android.widget.ListView; //導入方法依賴的package包/類
private void initViews(View view) {
    mScrollLayout = (ScrollLayout) view.findViewById(R.id.scrolllayout);
    mScrollLayout.setIsScroll(false);

    mEmptyView = (EmptyLayout) view.findViewById(R.id.error_layout);
    mLvCatalog = (ListView) view.findViewById(R.id.lv_catalog);
    mLvCatalog.setOnItemClickListener(mCatalogOnItemClick);
    mLvTag = (ListView) view.findViewById(R.id.lv_tag);
    mLvTag.setOnItemClickListener(mTagOnItemClick);
    if (mCatalogAdapter == null) {
        mCatalogAdapter = new SoftwareCatalogListAdapter();
        sendRequestCatalogData(mCatalogHandler);
    }
    mLvCatalog.setAdapter(mCatalogAdapter);

    if (mTagAdapter == null) {
        mTagAdapter = new SoftwareCatalogListAdapter();
    }
    mLvTag.setAdapter(mTagAdapter);

    if (mSoftwareAdapter == null) {
        mSoftwareAdapter = new SoftwareAdapter();
    }

    mLvSoftware = (ListView) view.findViewById(R.id.lv_software);
    mLvSoftware.setOnItemClickListener(this);
    mLvSoftware.setOnScrollListener(this);
    mLvSoftware.setAdapter(mSoftwareAdapter);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:30,代碼來源:SoftwareCatalogListFragment.java

示例13: getListView

import android.widget.ListView; //導入方法依賴的package包/類
/**
 * 獲取ListView並添加Footer
 */
private void getListView() {
    int child = getChildCount();
    if (child > 0) {
        View childView = getChildAt(0);
        if (childView instanceof ListView) {
            mListView = (ListView) childView;
            // 設置滾動監聽器給ListView, 使得滾動的情況下也可以自動加載
            mListView.setOnScrollListener(this);
        }
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:15,代碼來源:SuperRefreshLayout.java

示例14: onCreate

import android.widget.ListView; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transparent_toolbar);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    mScreenHeight = getResources().getDisplayMetrics().heightPixels;
    Log.e("CSDN_LQR", "screenHeight = " + mScreenHeight);
    mLv = (ListView) findViewById(R.id.lv);
    mLv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, Cheeses.NAMES));
    mLv.setOnScrollListener(this);
}
 
開發者ID:GitLqr,項目名稱:MaterialDesignDemo,代碼行數:14,代碼來源:TransparentToolbarActivity.java

示例15: initContactListView

import android.widget.ListView; //導入方法依賴的package包/類
private void initContactListView() {
    contactListView = (ListView) curView.findViewById(R.id.ContactListView);
    contactListView.setOnItemClickListener(this);
    contactListView.setOnItemLongClickListener(this);
    contactAdapter = new  ChatAdapter(getActivity());
    contactListView.setAdapter(contactAdapter);

    // this is critical, disable loading when finger sliding, otherwise
    // you'll find sliding is not very smooth
    contactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(),
            true, true));
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:13,代碼來源:ChatFragment.java


注:本文中的android.widget.ListView.setOnScrollListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。