当前位置: 首页>>代码示例>>Java>>正文


Java OnItemClickListener类代码示例

本文整理汇总了Java中android.widget.AdapterView.OnItemClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnItemClickListener类的具体用法?Java OnItemClickListener怎么用?Java OnItemClickListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OnItemClickListener类属于android.widget.AdapterView包,在下文中一共展示了OnItemClickListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    sGrid = new GridView(getActivity());
    sGrid.setNumColumns(KJEmojiConfig.COLUMNS);
    adapter = new EmojiGridAdapter(getActivity(), datas);
    sGrid.setAdapter(adapter);
    sGrid.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {
            EditText editText = (EditText) getActivity().findViewById(
                    R.id.emoji_titile_input);
            if (listener != null) {
                listener.onEmojiClick((Emojicon) parent.getAdapter()
                        .getItem(position));
            }
            if (editText != null)
                InputHelper.input2OSC(editText, (Emojicon) parent.getAdapter()
                        .getItem(position));
        }
    });
    sGrid.setSelector(R.drawable.ic_material);
    return sGrid;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:26,代码来源:EmojiPageFragment.java

示例2: getViewPagerItem

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private GridView getViewPagerItem(final int index) {
    GridView gridView = new GridView(_context);
    gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    gridView.setNumColumns(4);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setPadding(8, 8, 8, 0);
    gridView.setVerticalSpacing(20);
    gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));

    gridView.setAdapter(new YayaEmoGridViewAdapter(_context,
            getGridViewData(index)));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            int start = index * SysConstant.yayaPageSize;
            onEmoGridViewItemClick.onItemClick(position + start, index);
        }
    });
    return gridView;
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:24,代码来源:YayaEmoGridView.java

示例3: initEvent

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
@Override
public void initEvent() {//必须在onCreate方法内调用
	//示例代码<<<<<<<<<<<<<<<<<<<

	lvDemo.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			setResult(RESULT_OK, new Intent().putExtra(RESULT_CLICKED_ITEM, position));
			finish();
		}
	});

	//分页滚动示例代码<<<<<<<<<<<<<<<<<<<
	new PageScroller(lvDemo).init();
	//分页滚动示例代码>>>>>>>>>>>>>>>>>>>

	//示例代码>>>>>>>>>>>>>>>>>>>
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:DemoActivity.java

示例4: initEvent

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
@Override
public void initEvent() {//必须在onCreate方法内调用
	super.initEvent();
	//示例代码<<<<<<<<<<<<<<<<<<<

	lvBaseList.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			//				//如果lvBaseList有headerView或footerView <<<<<<<<<<<<<<<
			//				position -= lvBaseList.getHeaderViewsCount();//ListView的方法,GridView没有
			//				if (position < 0 || adapter == null || position >= adapter.getCount()) {
			//					return;
			//				}
			//				//如果lvBaseList有headerView或footerView >>>>>>>>>>>>>>>

			showShortToast("选择了 " + adapter.getItem(position).getValue());
			setResult(RESULT_OK, new Intent().putExtra(RESULT_CLICKED_ITEM, position));
			finish();
		}
	});
	//示例代码>>>>>>>>>>>>>>>>>>>
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:DemoListActivity.java

示例5: initializeSearchSuggestions

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
/**
 * method to generate search suggestions for the AutoCompleteTextView from
 * previously searched URLs
 */
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) {

	getUrl.setThreshold(1);
	getUrl.setDropDownWidth(-1);
	getUrl.setDropDownAnchor(R.id.toolbar_layout);
	getUrl.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

		}

	});

	getUrl.setSelectAllOnFocus(true);
	mSearchAdapter = new SearchAdapter(mActivity, mDarkTheme, isIncognito());
	getUrl.setAdapter(mSearchAdapter);
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:23,代码来源:BrowserActivity.java

示例6: initEvent

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBaseList.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			toActivity(UserActivity.createIntent(context, id));
		}
	});
}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:13,代码来源:UserListFragment.java

示例7: setAdapter

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
@Override
public FDialogMenu setAdapter(BaseAdapter adapter)
{
    lv_content.setAdapter(adapter);
    lv_content.setOnItemClickListener(new OnItemClickListener()
    {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id)
        {
            if (mCallback != null)
            {
                mCallback.onClickItem(view, (int) id, FDialogMenu.this);
            }
            dismissAfterClickIfNeed();
        }
    });
    return this;
}
 
开发者ID:zj565061763,项目名称:dialog,代码行数:19,代码来源:FDialogMenu.java

示例8: initViews

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initViews() {
	GridView gvIcons = (GridView) findViewById(R.id.icons);
	SimpleAdapter adapter = new SimpleAdapter(this, getIcons(),
			R.layout.item_editimage, new String[] { "item", "resId" },
			new int[] { R.id.item_editimage_ivIcon,
					R.id.item_editimaeg_tvResId });
	gvIcons.setAdapter(adapter);
	gvIcons.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			TextView tv1 = (TextView) arg1
					.findViewById(R.id.item_editimaeg_tvResId);
			int resId = Integer.valueOf(tv1.getText().toString());
			Intent intent = new Intent();
			intent.putExtra(RESULT, resId);
			EditImageAty.this.setResult(EditImageAty.this.getIntent()
					.getIntExtra(C_RESULT_CODE, 0), intent);
			EditImageAty.this.finish();
		}
	});
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:24,代码来源:EditImageAty.java

示例9: setUpHistory

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void setUpHistory() {
    registerForContextMenu(mHistoryView);
    mHistoryView.setAdapter(mHistoryAdapter);
    mHistoryView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    mHistoryView.setStackFromBottom(true);
    mHistoryView.setFocusable(false);
    mHistoryView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            int deleteMode = mLogic.getDeleteMode();
            if(mDisplay.getText().isEmpty()) deleteMode = Logic.DELETE_MODE_CLEAR;
            mDisplay.insert(((HistoryLine) view).getHistoryEntry().getEdited());
            mLogic.setDeleteMode(deleteMode);
        }
    });
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:17,代码来源:Calculator.java

示例10: DietPopView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
public DietPopView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mRecords = new ArrayList();
    this.itemClickListener = new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View view, final int position,
                                long id) {
            if (position >= DietPopView.this.adapter.startPosition() && position <
                    DietPopView.this.adapter.endPosition()) {
                if (DietPopView.this.dateClickListener != null) {
                    DietPopView.this.postDelayed(new Runnable() {
                        public void run() {
                            DietPopView.this.dateClickListener.onDateClick(DietPopView.this
                                    .adapter.getDate(position));
                        }
                    }, 500);
                }
                DietPopView.this.dateClickListener.onBottomClick();
                DietPopView.this.dismiss();
            }
        }
    };
    this.context = context;
    LayoutInflater.from(context).inflate(R.layout.op, this);
    ButterKnife.inject((View) this);
    initListener();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:DietPopView.java

示例11: initView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initView() {
    this.mAdapter = new CustomCookAdapter(this, this.mDataList, this.mDataSelect);
    this.tvAddCustom.setText("我的菜肴");
    this.blvContent.setAdapter(this.mAdapter);
    this.blvContent.setOnLoadMoreListener(new OnLoadMoreListener() {
        public void onLoadMore() {
            CustomCookListActivity.this.sendRequestCollection(true);
        }
    });
    this.blvContent.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            CustomCookActivity.comeOnBaby(CustomCookListActivity.this.activity, (
                    (CustomCookItem) CustomCookListActivity.this.mDataList.get(position)).id);
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:CustomCookListActivity.java

示例12: initView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initView() {
    this.listView = (ListView) this.pullRefreshLayout.getRefreshableView();
    this.pullRefreshLayout.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            StatusFavoriteFragment.this.page = 1;
            StatusFavoriteFragment.this.loadData(true);
        }
    });
    this.pullRefreshLayout.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            StatusFavoriteFragment.this.loadMoreData(false);
        }
    });
    this.listView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            Intent intent = new Intent(StatusFavoriteFragment.this.getActivity(),
                    CommentListActivity.class);
            intent.putExtra(CommentListActivity.POST_ID, ((Post) StatusFavoriteFragment.this
                    .postList.get(position - 1)).id);
            StatusFavoriteFragment.this.startActivity(intent);
        }
    });
    initAdapter();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:StatusFavoriteFragment.java

示例13: initListView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initListView() {
    this.mPullToRefreshListView = (PullToRefreshListView) getView().findViewById(R.id.listview);
    this.mListView = (ListView) this.mPullToRefreshListView.getRefreshableView();
    this.mPullToRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            FansFragment.this.page = 1;
            FansFragment.this.getFans();
        }
    });
    this.mPullToRefreshListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View arg1, int arg2, long arg3) {
            Intent intent = new Intent(FansFragment.this.getActivity(), UserTimelineActivity
                    .class);
            intent.putExtra(UserTimelineActivity.NICK_NAME, FansFragment.this.mAdapter
                    .getItem(arg2 - 1).nickname);
            FansFragment.this.startActivity(intent);
        }
    });
    this.mPullToRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (!FansFragment.this.isLastVisible) {
                FansFragment.this.getNextFans();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:FansFragment.java

示例14: initListView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initListView() {
    this.mPullToRefreshListView = (PullToRefreshListView) getView().findViewById(R.id.listview);
    this.mListView = (ListView) this.mPullToRefreshListView.getRefreshableView();
    this.mPullToRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            FriendFragment.this.getFriends();
        }
    });
    this.mPullToRefreshListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View arg1, int arg2, long arg3) {
            Intent intent = new Intent(FriendFragment.this.getActivity(),
                    UserTimelineActivity.class);
            intent.putExtra(UserTimelineActivity.NICK_NAME, FriendFragment.this.mAdapter
                    .getItem(arg2 - 1).nickname);
            FriendFragment.this.startActivity(intent);
        }
    });
    this.mPullToRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (!FriendFragment.this.isLastVisible) {
                FriendFragment.this.getNextFriends();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:FriendFragment.java

示例15: initView

import android.widget.AdapterView.OnItemClickListener; //导入依赖的package包/类
private void initView() {
    View headerView = LayoutInflater.from(this.ctx).inflate(R.layout.h6, null);
    this.ivHeader = (ImageView) headerView.findViewById(R.id.iv_header);
    ViewUtils.setViewScaleHeight(this.ctx, this.ivHeader, 2, 1);
    ((ListView) this.pullToRefreshListView.getRefreshableView()).addHeaderView(headerView);
    this.pullToRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            SuccessStoryActivity.this.page = 1;
            SuccessStoryActivity.this.requestData();
        }
    });
    this.pullToRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            SuccessStoryActivity.this.page = SuccessStoryActivity.this.page + 1;
            SuccessStoryActivity.this.requestData();
        }
    });
    this.pullToRefreshListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            ItemsEntity itemsEntity = (ItemsEntity) adapterView.getAdapter().getItem(i);
            if (itemsEntity != null) {
                BooheeScheme.handleUrl(SuccessStoryActivity.this.ctx, itemsEntity.url);
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:SuccessStoryActivity.java


注:本文中的android.widget.AdapterView.OnItemClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。