本文整理匯總了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));
}