当前位置: 首页>>代码示例>>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;未经允许,请勿转载。