久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

僅在第二次單擊時調用 textview 上的 Onclick 事件

Onclick event on textview(that has TextIsSelectable=quot;truequot;) is ony called on second click(僅在第二次單擊時調用 textview 上的 Onclick 事件(具有 TextIsSelectable=“true))
本文介紹了僅在第二次單擊時調用 textview 上的 Onclick 事件(具有 TextIsSelectable=“true")的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 textview 上有一個 onClickListener,而 textview 的標志是它是 selectable.但是我指定的 onclick 事件只有在 textview 被第二次點擊時才會被調用.在第二次之后它調用 onclick 權限,但是如果另一個 textview 也是 selectableonclicklistener 它也只被稱為第二次時間,然后它工作正常,但另一個只工作第二次.我找不到這些奇怪事件的來源.

I have a onClickListener on a textview and the textview has the flag that it's selectable. But the onclick event I specified is only called when the textview is clicked a second time. After the second time it calles the onclick right, but if a other textview that also is selectable with a onclicklistener it also is only called the second time, then it works fine, but then the other one works only the second time again. I can't find the source of these weird events.

telefoonTXT.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {startTelIntent();}}
);

urlTXT.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {startWebIntent();}
});

推薦答案

我也遇到過這個問題.每當觸摸文本視圖時,首先onTouch,然后是OnSelection,最后是OnClick.如果我清楚地理解您的問題,您想在用戶 雙擊long press 時選擇文本視圖中的文本,就像通常的文本選擇一樣,但是當用戶只需單擊它時,您想要onClick 功能.我認為以下內容可能會對您有所幫助.

I faced this issue as well. Whenever text view is touched firstly onTouch, then OnSelection and at last OnClick is called. If i understand your problem clearly you want to select text in text view when user double taps or long presses like the usual text selection but when user simply clicks it once u want the onClick to function. I think the following might help you.

gestureDetector 添加到您的文本視圖中.

Add a gestureDetector to your text View.

GestureDetectorCompat mDetector;
mDetector = new GestureDetectorCompat(this, new GestureDetector.SimpleOnGestureListener());

mDetector.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {
    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        // This is where u add your OnClick event
        startTelIntent();
        return false;
    }

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        Log.d("dtttt", "double tap");
        return false;
    }

    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        return false;
    }
});

telefoonTXT.setOnTouchListener(new View.OnTouchListener() {
     @Override
     public boolean onTouch(View v, MotionEvent event) {
          mDetector.onTouchEvent(event);
          return false;
     }
});

這篇關于僅在第二次單擊時調用 textview 上的 Onclick 事件(具有 TextIsSelectable=“true")的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 日韩亚洲欧美综合 | 国产特级毛片aaaaaa喷潮 | 久久网一区二区 | 中文字幕免费在线观看 | 亚洲小视频 | 午夜精 | 九九久久99 | 日韩欧美二区 | 日韩在线视频观看 | 中文字幕av免费 | 欧美黄色精品 | 国产精品亚洲视频 | 精品欧美一区二区三区精品久久 | 天天操操操操操 | 人人cao| 一区二区三区在线播放 | 国产精品一区一区三区 | 国产成人精品一区二区 | 九九久久99 | 欧美精品a∨在线观看不卡 国产精品久久国产精品 | 99久久国产综合精品麻豆 | av看片网| 国产玖玖| 黄色a三级| 永久免费av| 成人av一区二区亚洲精 | 成人综合视频在线观看 | 亚洲精品久久久久久久久久久久久 | 免费观看黄色片视频 | 国产日韩欧美一区 | 日韩一级免费大片 | 日韩资源 | 亚洲欧美中文日韩在线v日本 | 国产一区h | 国产精品国产成人国产三级 | 亚洲精品免费在线 | 亚洲国产精品99久久久久久久久 | 91丨九色丨国产在线 | 日韩中文一区 | 亚洲黄色av | 午夜精品久久久久久久久久久久久 |