久久久久久久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(使用線程逐塊處理文件)
主站蜘蛛池模板: 久久久婷 | 国产精品综合色区在线观看 | 日韩欧美在线一区 | 午夜电影网 | 在线看一区二区 | 精品福利一区 | 日韩在线一区二区三区 | 国产视频1 | cao在线 | 亚洲激情综合网 | 在线一区视频 | 日韩欧美精品 | 成人高清在线视频 | 久久一级 | 国产女人与拘做视频免费 | 成人久久久| 亚洲一区免费视频 | 国产一区二区三区高清 | 国产xxxx岁13xxxxhd | 美女高潮网站 | 黄色国产在线视频 | 日本免费在线 | 中文字幕 在线观看 | 在线观看av不卡 | 欧美激情欧美激情在线五月 | 国产精品久久久久国产a级 欧美日韩国产免费 | 日本在线视频一区二区 | 国产传媒毛片精品视频第一次 | 亚洲精品二区 | 久久精品网 | 伊人网伊人| 国产伦精品一区二区三区高清 | 国产精品一区一区 | 国产精品一区二区三区在线 | 亚洲成人一区二区三区 | 午夜精品一区二区三区在线视频 | 精品国产91乱码一区二区三区 | 秋霞av国产精品一区 | a免费视频 | 91精品国产综合久久久久久首页 | 久久免费国产 |