本文整理了Java中android.widget.GridView.setOnScrollListener()
方法的一些代码示例,展示了GridView.setOnScrollListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridView.setOnScrollListener()
方法的具体详情如下:
包路径:android.widget.GridView
类名称:GridView
方法名:setOnScrollListener
暂无
代码示例来源:origin: TonicArtos/StickyGridHeaders
public StickyGridHeadersGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
super.setOnScrollListener(this);
setVerticalFadingEdgeEnabled(false);
if (!mNumColumnsSet) {
mNumColumns = AUTO_FIT;
}
ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
}
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
private void init() {
mChildrenHeights = new SparseIntArray();
mHeaderViewInfos = new ArrayList<>();
mFooterViewInfos = new ArrayList<>();
super.setClipChildren(false);
super.setOnScrollListener(mScrollListener);
}
代码示例来源:origin: square/picasso
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_gridview_activity);
GridView gv = findViewById(R.id.grid_view);
gv.setAdapter(new SampleGridViewAdapter(this));
gv.setOnScrollListener(new SampleScrollListener(this));
}
}
代码示例来源:origin: Aspsine/SwipeToLoadLayout
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
swipeToLoadLayout = (SwipeToLoadLayout) view.findViewById(R.id.swipeToLoadLayout);
gridView = (GridView) view.findViewById(R.id.swipe_target);
swipeToLoadLayout.setOnRefreshListener(this);
swipeToLoadLayout.setOnLoadMoreListener(this);
gridView.setAdapter(mAdapter);
gridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
if (!ViewCompat.canScrollVertically(view, 1)) {
swipeToLoadLayout.setLoadingMore(true);
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
}
代码示例来源:origin: lovetuzitong/MultiImageSelector
mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
代码示例来源:origin: bingoogolapple/BGARefreshLayout-Android
@Override
protected void setListener() {
mRefreshLayout.setDelegate(this);
mRefreshLayout.setRefreshScaleDelegate(new BGARefreshLayout.BGARefreshScaleDelegate() {
@Override
public void onRefreshScaleChanged(float scale, int moveYDistance) {
Log.i(TAG, "scale:" + scale + " moveYDistance:" + moveYDistance);
}
});
mDataGv.setOnItemClickListener(this);
mDataGv.setOnItemLongClickListener(this);
mDataGv.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
Log.i(TAG, "滚动状态变化");
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
Log.i(TAG, "正在滚动");
}
});
mAdapter = new NormalAdapterViewAdapter(mApp);
mAdapter.setOnItemChildClickListener(this);
mAdapter.setOnItemChildLongClickListener(this);
getViewById(R.id.beginRefreshing).setOnClickListener(this);
getViewById(R.id.beginLoadingMore).setOnClickListener(this);
}
代码示例来源:origin: UweTrottmann/SeriesGuide
public StickyGridHeadersGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
super.setOnScrollListener(this);
setVerticalFadingEdgeEnabled(false);
if (!mNumColumnsSet) {
mNumColumns = AUTO_FIT;
}
ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
}
代码示例来源:origin: pili-engineering/PLDroidShortVideo
mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
代码示例来源:origin: WeAreFairphone/FP2-Launcher
@Override
public void setOnScrollListener(OnScrollListener l)
{
scrollListenerFromActivity = l;
//Guardo la referencia del scroll para poder usar ambos
super.setOnScrollListener(this);
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
private void init(Context context)
{
super.setOnScrollListener(this);
}
代码示例来源:origin: zzkong/BaseProject
@Override
@Deprecated
public void setOnScrollListener(OnScrollListener onScrollListener) {
super.setOnScrollListener(onScrollListener);
}
代码示例来源:origin: xiangzhihong/newsApp
private void setLstener() {
//spinner的点击事件
sp.setOnItemSelectedListener(this);
//设置下拉刷新事件监听
refreshLayout.setOnRefreshListener(this);
//Gridview的点击事件
game_grid.setOnItemClickListener(this);
//GridView的滚动事件监听
game_grid.setOnScrollListener(this);
}
代码示例来源:origin: stackoverflow.com
final GridView g = (GridView) findViewById(R.id.myGrid);
g.setAdapter(new ImageAdapter(this));
EndlessScrollListener scrollListener=new EndlessScrollListener(g,new RefreshList() {
@Override
public void onRefresh(int pageNumber) {
System.out.println("On Refresh invoked..");
}
});
g.setOnScrollListener(scrollListener);
代码示例来源:origin: julesbond007/android-jigsaw-puzzle
public void init(Context context) {
super.setOnScrollListener(mScrollListener);
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mSmoothScrollAmountAtEdge = (int) (SMOOTH_SCROLL_AMOUNT_AT_EDGE
* metrics.density + 0.5f);
mOverlapIfSwitchStraightLine = getResources().getDimensionPixelSize(
R.dimen.dgv_overlap_if_switch_straight_line);
}
代码示例来源:origin: HenriDellal/emerald
@Override
protected void onDestroy() {
//Log.v(APP_TAG, "onDestroy");
grid.setOnScrollListener(null);
grid.setOnTouchListener(null);
super.onDestroy();
}
代码示例来源:origin: canqihe/TmallSale
public StickyGridHeadersGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
super.setOnScrollListener(this);
setVerticalFadingEdgeEnabled(false);
if (!mNumColumnsSet) {
mNumColumns = AUTO_FIT;
}
ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
}
代码示例来源:origin: macdidi5/Android-Things-Tutorial
public void init(Context context) {
super.setOnScrollListener(mScrollListener);
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mSmoothScrollAmountAtEdge = (int) (SMOOTH_SCROLL_AMOUNT_AT_EDGE * metrics.density + 0.5f);
mOverlapIfSwitchStraightLine = getResources().getDimensionPixelSize(R.dimen.dgv_overlap_if_switch_straight_line);
}
代码示例来源:origin: stackoverflow.com
final GridView g = (GridView) findViewById(R.id.myGrid);
g.setAdapter(new ImageAdapter(this));
EndlessScrollListener scrollListener=new EndlessScrollListener(g,new RefreshList() {
@Override
public void onRefresh(int pageNumber) {
System.out.println("On Refresh invoked..");
}
});
g.setOnScrollListener(scrollListener);
代码示例来源:origin: XuDeveloper/XImageLoader
private void initViews() {
mGridView = (GridView) findViewById(R.id.gridView);
mImageAdapter = new ImageAdapter(this, urls);
mGridView.setAdapter(mImageAdapter);
mGridView.setOnScrollListener(this);
}
代码示例来源:origin: stackoverflow.com
public class MainActivity extends Activity implements OnScrollListener {
ArrayAdapter<String> adapter;
GridView gridphoto;
Button loadMore;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gridphoto = (GridView) findViewById(R.id.gridphoto);
loadMore = (Button) findViewById(R.id.loadmore);
gridphoto.setOnScrollListener(this);
adapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
for (int i = 0; i < 80; i++) {
adapter.add("dummy data " + i);
}
gridphoto.setAdapter(adapter);
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (gridphoto.getLastVisiblePosition() + 1 == 80) {
loadMore.setVisibility(View.VISIBLE); // Load More Button
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
}
}
内容来源于网络,如有侵权,请联系作者删除!