android.widget.ListView.getId()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中android.widget.ListView.getId()方法的一些代码示例,展示了ListView.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.getId()方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:getId

ListView.getId介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

setOnScrollListener(new OnScrollListener(){
 public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
  // TODO Auto-generated method stub
 }
 public void onScrollStateChanged(AbsListView view, int scrollState) {
  // TODO Auto-generated method stub
  final ListView lw = getListView();
   if(scrollState == 0) 
  Log.i("a", "scrolling stopped...");
   if (view.getId() == lw.getId()) {
   final int currentFirstVisibleItem = lw.getFirstVisiblePosition();
    if (currentFirstVisibleItem > mLastFirstVisibleItem) {
     mIsScrollingUp = false;
     Log.i("a", "scrolling down...");
   } else if (currentFirstVisibleItem < mLastFirstVisibleItem) {
     mIsScrollingUp = true;
     Log.i("a", "scrolling up...");
   }
   mLastFirstVisibleItem = currentFirstVisibleItem;
 } 
 }
});

代码示例来源:origin: stackoverflow.com

private int mLastFirstVisibleItem;
private boolean mIsScrollingUp;

public void onScrollStateChanged(AbsListView view, int scrollState) {
  final ListView lw = getListView();

  if (view.getId() == lw.getId()) {
    final int currentFirstVisibleItem = lw.getFirstVisiblePosition();

    if (currentFirstVisibleItem > mLastFirstVisibleItem) {
      mIsScrollingUp = false;
    } else if (currentFirstVisibleItem < mLastFirstVisibleItem) {
      mIsScrollingUp = true;
    }

    mLastFirstVisibleItem = currentFirstVisibleItem;
  } 
}

代码示例来源:origin: stackoverflow.com

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {

  switch(l.getId())
  {
    case R.id.list:
    {
     // do list A stuff
     break;
    }
    case R.id.list2:
    {
     // do list B stuff
     break;
    }
  }
}

代码示例来源:origin: stackoverflow.com

private int mLastFirstVisibleItem;
private ListView listView;
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
   @Override
   public void onScrollStateChanged(AbsListView view, int scrollState) {
     if (view.getId() == listView.getId()) {
       final int currentFirstVisibleItem = listView.getFirstVisiblePosition();
       if (currentFirstVisibleItem > mLastFirstVisibleItem) {
         cardView.setVisibility(View.GONE);
       } else if (currentFirstVisibleItem < mLastFirstVisibleItem) {
         cardView.setVisibility(View.VISIBLE);
       }
       mLastFirstVisibleItem = currentFirstVisibleItem;
     }
   }

代码示例来源:origin: z3896823/PanelList

Log.d(TAG, "reorganizeViewGroup: " + onRefreshListener.toString());
RelativeLayout.LayoutParams lp_srl = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
lp_srl.addRule(RelativeLayout.RIGHT_OF, lv_column.getId());
lp_srl.addRule(RelativeLayout.BELOW, tv_title.getId());
pl_root.addView(swipeRefreshLayout, lp_srl);

相关文章

ListView类方法