本文整理了Java中android.view.View.setOnLongClickListener()
方法的一些代码示例,展示了View.setOnLongClickListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setOnLongClickListener()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setOnLongClickListener
暂无
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row) {
super(row);
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row) {
super(row);
title=row.findViewById(android.R.id.text1);
thumbnail=row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row) {
super(row);
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row, OnStartDragListener listener) {
super(row);
this.listener=listener;
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row) {
super(row);
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row) {
super(row);
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
}
代码示例来源:origin: commonsguy/cw-omnibus
RowController(View row, ChoiceCapableAdapter<?> adapter) {
super(row);
this.adapter=adapter;
title=(TextView)row.findViewById(android.R.id.text1);
thumbnail=(ImageView)row.findViewById(R.id.thumbnail);
row.setOnClickListener(this);
row.setOnLongClickListener(this);
row.setOnTouchListener(this);
}
代码示例来源:origin: google/agera
@BindingAdapter({"bind:onLongClick"})
public static void onLongClick(@NonNull final View view,
@NonNull final OnClickListener onClickListener) {
view.setOnLongClickListener(clickView -> {
onClickListener.onClick(clickView);
return true;
});
}
代码示例来源:origin: facebook/litho
static void setComponentLongClickListener(View v, ComponentLongClickListener listener) {
if (v instanceof ComponentHost) {
((ComponentHost) v).setComponentLongClickListener(listener);
} else {
v.setOnLongClickListener(listener);
v.setTag(R.id.component_long_click_listener, listener);
}
}
代码示例来源:origin: TeamNewPipe/NewPipe
private void disableLongClick() {
itemView.setLongClickable(false);
itemView.setOnLongClickListener(null);
}
}
代码示例来源:origin: hongyangAndroid/baseAdapter
public ViewHolder setOnLongClickListener(int viewId,
View.OnLongClickListener listener)
{
View view = getView(viewId);
view.setOnLongClickListener(listener);
return this;
}
代码示例来源:origin: androidquery/androidquery
/**
* Register a callback method for when the view is long clicked.
*
* @param listener The callback method.
* @return self
*/
public T longClicked(OnLongClickListener listener){
if(view != null){
view.setOnLongClickListener(listener);
}
return self();
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
this.onLongClickListener = onLongClickListener;
directly().setOnLongClickListener(onLongClickListener);
}
代码示例来源:origin: TommyLemon/APIJSON
@Override
public void initEvent() {
findViewById(R.id.llAboutUpdate).setOnClickListener(this);
findViewById(R.id.llAboutShare).setOnClickListener(this);
findViewById(R.id.llAboutComment).setOnClickListener(this);
findViewById(R.id.llAboutDeveloper, this).setOnLongClickListener(this);
findViewById(R.id.llAboutWeibo, this).setOnLongClickListener(this);
findViewById(R.id.llAboutContactUs, this).setOnLongClickListener(this);
}
代码示例来源:origin: TeamNewPipe/NewPipe
private void unsetSearchListeners() {
if (DEBUG) Log.d(TAG, "unsetSearchListeners() called");
searchClear.setOnClickListener(null);
searchClear.setOnLongClickListener(null);
searchEditText.setOnClickListener(null);
searchEditText.setOnFocusChangeListener(null);
searchEditText.setOnEditorActionListener(null);
if (textWatcher != null) searchEditText.removeTextChangedListener(textWatcher);
textWatcher = null;
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
@Override
public void initEvent() {
findView(R.id.llAboutMainTabActivity).setOnClickListener(this);
findView(R.id.llAboutZBLibraryMainActivity).setOnClickListener(this);
findView(R.id.llAboutUpdate).setOnClickListener(this);
findView(R.id.llAboutShare).setOnClickListener(this);
findView(R.id.llAboutComment).setOnClickListener(this);
findView(R.id.llAboutDeveloper, this).setOnLongClickListener(this);
findView(R.id.llAboutWeibo, this).setOnLongClickListener(this);
findView(R.id.llAboutContactUs, this).setOnLongClickListener(this);
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
public void onBindViewHolder(final ClickableViewHolder holder, final int position) {
holder.getParentView().setOnClickListener(v -> {
if (itemClickListener != null) {
itemClickListener.onItemClick(position, holder);
}
});
holder.getParentView().setOnLongClickListener(v -> itemLongClickListener != null
&& itemLongClickListener.onItemLongClick(position, holder));
}
代码示例来源:origin: TeamNewPipe/NewPipe
private void enableLongClick(final StreamInfoItem item) {
itemView.setLongClickable(true);
itemView.setOnLongClickListener(view -> {
if (itemBuilder.getOnStreamSelectedListener() != null) {
itemBuilder.getOnStreamSelectedListener().held(item);
}
return true;
});
}
代码示例来源:origin: robolectric/robolectric
@Test
public void performLongClick_shouldClickOnView() throws Exception {
OnLongClickListener clickListener = mock(OnLongClickListener.class);
shadowOf(view).setMyParent(ReflectionHelpers.createNullProxy(ViewParent.class));
view.setOnLongClickListener(clickListener);
view.performLongClick();
verify(clickListener).onLongClick(view);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldLongClickAndNotLongClick() throws Exception {
assertThat(view.isLongClickable()).isFalse();
view.setLongClickable(true);
assertThat(view.isLongClickable()).isTrue();
view.setLongClickable(false);
assertThat(view.isLongClickable()).isFalse();
view.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return false;
}
});
assertThat(view.isLongClickable()).isTrue();
}
内容来源于网络,如有侵权,请联系作者删除!