android.widget.TextView.setOnLongClickListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(198)

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

TextView.setOnLongClickListener介绍

暂无

代码示例

代码示例来源:origin: EverythingMe/overscroll-decor

public DemoViewHolder(int resId, ViewGroup parent, LayoutInflater inflater) {
  mTextView = (TextView) inflater.inflate(resId, parent, false);
  mTextView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      Toast.makeText(mTextView.getContext(), "Tapped on: "+mTextView.getText(), Toast.LENGTH_SHORT).show();
    }
  });
  mTextView.setOnLongClickListener(new View.OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
      Toast.makeText(mTextView.getContext(), "Long-tapped on: "+mTextView.getText(), Toast.LENGTH_SHORT).show();
      return false;
    }
  });
}

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

imgViewRemoveIcon.setOnClickListener(this);
v.setOnClickListener(this);
mTextViewContent.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View view) {

代码示例来源:origin: EverythingMe/overscroll-decor

public DemoViewHolder(int resId, ViewGroup parent, LayoutInflater inflater) {
  super(inflater.inflate(resId, parent, false));
  getTextView().setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      Toast.makeText(getTextView().getContext(), "Tapped on: "+getTextView().getText(), Toast.LENGTH_SHORT).show();
    }
  });
  getTextView().setOnLongClickListener(new View.OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
      Toast.makeText(getTextView().getContext(), "Long-tapped on: "+getTextView().getText(), Toast.LENGTH_SHORT).show();
      return false;
    }
  });
}

代码示例来源:origin: mcxtzhang/SwipeDelMenuLayout

holder.content.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
protected void initListeners() {
  super.initListeners();
  infoItemBuilder.setOnStreamSelectedListener(new OnClickGesture<StreamInfoItem>() {
    @Override
    public void selected(StreamInfoItem selectedItem) {
      selectAndLoadVideo(selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
    }
    @Override
    public void held(StreamInfoItem selectedItem) {
      showStreamDialog(selectedItem);
    }
  });
  videoTitleRoot.setOnClickListener(this);
  uploaderRootLayout.setOnClickListener(this);
  thumbnailBackgroundButton.setOnClickListener(this);
  detailControlsBackground.setOnClickListener(this);
  detailControlsPopup.setOnClickListener(this);
  detailControlsAddToPlaylist.setOnClickListener(this);
  detailControlsDownload.setOnClickListener(this);
  detailControlsDownload.setOnLongClickListener(this);
  relatedStreamExpandButton.setOnClickListener(this);
  detailControlsBackground.setLongClickable(true);
  detailControlsPopup.setLongClickable(true);
  detailControlsBackground.setOnLongClickListener(this);
  detailControlsPopup.setOnLongClickListener(this);
  detailControlsBackground.setOnTouchListener(getOnControlsTouchListener());
  detailControlsPopup.setOnTouchListener(getOnControlsTouchListener());
}

代码示例来源:origin: mikepenz/AboutLibraries

holder.libraryCreator.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {
holder.libraryCreator.setOnTouchListener(null);
holder.libraryCreator.setOnClickListener(null);
holder.libraryCreator.setOnLongClickListener(null);
holder.libraryDescription.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {
holder.libraryDescription.setOnTouchListener(null);
holder.libraryDescription.setOnClickListener(null);
holder.libraryDescription.setOnLongClickListener(null);

代码示例来源:origin: jaydenxiao2016/AndroidFire

commentTv.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {

代码示例来源:origin: seven332/EhViewer

tag.setTag(R.id.tag, tg.groupName + ":" + tagStr);
tag.setOnClickListener(this);
tag.setOnLongClickListener(this);

代码示例来源:origin: iMeiji/Toutiao

myHolder.textView.setOnLongClickListener(v -> {
  if (!isEditMode) {
    RecyclerView recyclerView = ((RecyclerView) parent);

代码示例来源:origin: Naoki2015/CircleDemo

commentTv.setOnLongClickListener(new View.OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {

代码示例来源:origin: k9mail/k-9

mBccView.setOnClickListener(this);
mFromView.setOnLongClickListener(this);
mToView.setOnLongClickListener(this);
mCcView.setOnLongClickListener(this);
mBccView.setOnLongClickListener(this);

代码示例来源:origin: seven332/EhViewer

mOtherActions.setOnClickListener(this);
mDownload.setOnClickListener(this);
mDownload.setOnLongClickListener(this);
mRead.setOnClickListener(this);
mUploader.setOnLongClickListener(this);

代码示例来源:origin: enricocid/LaunchEnr

@Override
public void setOnLongClickListener(OnLongClickListener l) {
  super.setOnLongClickListener(l);
  mOnLongClickListener = l;
}

代码示例来源:origin: klinker24/launcher3

@Override
public void setOnLongClickListener(OnLongClickListener l) {
  super.setOnLongClickListener(l);
  mOnLongClickListener = l;
}

代码示例来源:origin: jclehner/rxdroid

public DrugNameView(Context context, AttributeSet attrs, int defStyle)
{
  super(context, attrs, defStyle);
  super.setOnClickListener(mLocalOnClickListener);
  super.setOnLongClickListener(mLocalOnLongClickListener);
}

代码示例来源:origin: GeoODK/collect

@Override
public void setOnLongClickListener(OnLongClickListener l) {
  mGetBearingButton.setOnLongClickListener(l);
  mStringAnswer.setOnLongClickListener(l);
  mAnswerDisplay.setOnLongClickListener(l);
}

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

private void init(Context c, LinearLayout root) {   
  LinearLayout container = (LinearLayout) LayoutInflater.from(c).inflate(R.layout.calendrieradmin_day_event, root, false);
  TextView name = (TextView) container.findViewById(R.id.CalendrierAdmin_Day_Event_TextView_Name);

  LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, 0, duree);        
  container.setLayoutParams(lp);

  name.setLayoutParams(lptv);

  name.setText(e.getNom());

  root.addView(container);

  name.setOnClickListener(this);
  name.setOnLongClickListener(this);
}

代码示例来源:origin: GeoODK/collect

@Override
public void setOnLongClickListener(OnLongClickListener l) {
  mStringAnswer.setOnLongClickListener(l);
  mGetBarcodeButton.setOnLongClickListener(l);
}

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

public TextView htmltextview;

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  ...

  htmltextview.setOnLongClickListener(new OnLongClickListener(){

    public boolean onLongClick(View v) {
      htmltextview.setCursorVisible(true);
      return false;
    }
  });

}

代码示例来源:origin: GeoODK/collect

@Override
public void setOnLongClickListener(OnLongClickListener l) {
  /*
  mViewButton.setOnLongClickListener(l);
  */
  mGetLocationButton.setOnLongClickListener(l);
  //mStringAnswer.setOnLongClickListener(l);
  mAnswerDisplay.setOnLongClickListener(l);
}

相关文章

TextView类方法