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

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

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

TextView.setOnTouchListener介绍

暂无

代码示例

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

TextView forgot_pswrd = (TextView) findViewById(R.id.ForgotPasswordText);
 forgot_pswrd.setOnTouchListener(this);     
 LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
 llp.setMargins(50, 0, 0, 0); // llp.setMargins(left, top, right, bottom);
 forgot_pswrd.setLayoutParams(llp);

代码示例来源:origin: wangdan/AisenWeiBo

public void bindOnTouchListener(TextView textView) {
  textView.setClickable(false);
  textView.setOnTouchListener(onTouchListener);
}

代码示例来源:origin: hidroh/materialistic

textView.setOnTouchListener(new View.OnTouchListener() {
  @SuppressLint("ClickableViewAccessibility")
  @Override

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

_view.setLayoutParams(layoutParams);
_view.setOnTouchListener(this);
_root.addView(_view);

代码示例来源: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: TommyLemon/APIJSON

@Override
public void initEvent() {//必须调用
  tvBaseTitle.setOnTouchListener(this);
  findViewById(R.id.tvLoginForget).setOnClickListener(this);
  findViewById(R.id.tvLoginLogin).setOnClickListener(this);
  new TextClearSuit().addClearListener(etLoginPhone, findViewById(R.id.ivLoginPhoneClear));
  new TextClearSuit().addClearListener(etLoginPassword, findViewById(R.id.ivLoginPasswordClear));
}

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

holder.libraryCreator.setOnTouchListener(rippleForegroundListener);
holder.libraryCreator.setOnClickListener(new View.OnClickListener() {
  @Override
holder.libraryCreator.setOnTouchListener(null);
holder.libraryCreator.setOnClickListener(null);
holder.libraryCreator.setOnLongClickListener(null);
holder.libraryDescription.setOnTouchListener(rippleForegroundListener);
holder.libraryDescription.setOnClickListener(new View.OnClickListener() {
  @Override
holder.libraryDescription.setOnTouchListener(null);
holder.libraryDescription.setOnClickListener(null);
holder.libraryDescription.setOnLongClickListener(null);

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

});
myHolder.textView.setOnTouchListener((v, event) -> {
  if (isEditMode) {
    switch (MotionEventCompat.getActionMasked(event)) {

代码示例来源:origin: Piasy/RxAndroidAudio

mAudioRecorder.setOnErrorListener(this);
mTvPressToSay.setOnTouchListener((v, event) -> {
  switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:

代码示例来源:origin: brianwernick/RecyclerExt

public void setOnTouchListener(View.OnTouchListener listener) {
    textView.setOnTouchListener(listener);
  }
}

代码示例来源:origin: SiberiaDante/TitleLayout

/**
 * 标题增加单击双击事件
 *
 * @param onMultiTouchListener
 */
@SuppressLint("ClickableViewAccessibility")
public void setTitleClickListener(OnMultiTouchListener onMultiTouchListener) {
  mTvTitle.setOnTouchListener(onMultiTouchListener);
}

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

TextView forgot_pswrd = (TextView) findViewById(R.id.ForgotPasswordText);
 forgot_pswrd.setOnTouchListener(this);     
 LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
 llp.setMargins(30, 0, 0, 0); // llp.setMargins(left, top, right, bottom);
 forgot_pswrd.setLayoutParams(llp);

代码示例来源:origin: jiangzepeng/MaterialAnim

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_reveal_anim);
  ButterKnife.bind(this);
  revealHead.setOnTouchListener(this);
  revealMiddle.setOnTouchListener(this);
  revealBottom.setOnTouchListener(this);
}

代码示例来源:origin: jenly1314/WanAndroid

public void clickRightClear(final TextView tv){
  tv.setOnTouchListener((v, event) -> {
    switch (event.getAction()){
      case MotionEvent.ACTION_UP:
        return clickRightClear(tv,event);
    }
    return false;
  });
}

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

ArrayList<Integer> randomized = Random(length);
for(int i=0;i<length;i++){
      int k = randomized.get(i);
        TextView tv = new TextView(this);
        tv.setText(String.valueOf(char_text[k]));
        tv.setId(k);
        tv.setTextSize(30);
        tv.setBackgroundColor(0xff00ff00);
        tv.setPadding(5, 5, 5, 5);
        tv.setOnTouchListener(new MyTouchListener());
        layout.addView(tv);
    }

代码示例来源:origin: andstatus/andstatus

/**
 * Substitute for: textView.setMovementMethod(LinkMovementMethod.getInstance());
 * setMovementMethod intercepts click on a text part without links,
 * so we replace it with our own method.
 * Solution to have clickable both links and other text is found here:
 * http://stackoverflow.com/questions/7236840/android-textview-linkify-intercepts-with-parent-view-gestures
 * following an advice from here:
 * http://stackoverflow.com/questions/7515710/listview-onclick-event-doesnt-fire-with-linkified-email-address?rq=1
 */
public static void setOnTouchListener(TextView textView) {
  textView.setMovementMethod(null);
  textView.setOnTouchListener((v, event) -> onTouchEvent(v, event));
}

代码示例来源:origin: fmgarcia27/AndroidstudioProjects

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  texto = (TextView)findViewById(R.id.text);
  texto.setOnTouchListener(this);
}

代码示例来源:origin: andforce/iBeebo

private void bindOnTouchListener(ViewHolder holder) {
  holder.listview_root.setClickable(false);
  holder.username.setClickable(false);
  holder.time.setClickable(false);
  holder.weiboTextContent.setClickable(false);
  holder.repost_content.setClickable(false);
  if (holder.weiboTextContent != null) {
    holder.weiboTextContent.setOnTouchListener(onTouchListener);
  }
  if (holder.repost_content != null) {
    holder.repost_content.setOnTouchListener(onTouchListener);
  }
}

代码示例来源:origin: andforce/iBeebo

private void bindOnTouchListener(DMViewHolder holder) {
  holder.username.setClickable(false);
  holder.time.setClickable(false);
  holder.content.setClickable(false);
  if (holder.content != null) {
    holder.content.setOnTouchListener(onTouchListener);
  }
}

代码示例来源:origin: andforce/iBeebo

private void bindOnTouchListener(ViewHolder holder) {
  holder.listview_root.setClickable(false);
  holder.username.setClickable(false);
  holder.time.setClickable(false);
  holder.weiboTextContent.setClickable(false);
  if (holder.weiboTextContent != null) {
    holder.weiboTextContent.setOnTouchListener(onTouchListener);
  }
}

相关文章

TextView类方法