本文整理汇总了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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
示例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...");
}
}
}
示例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);
}
示例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();
}
}
示例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;
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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));
}