加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在XML布局上的长按定义,如android:onClick

发布时间:2020-12-16 07:52:09 所属栏目:百科 来源:网络整理
导读:有什么办法定义为 XML布局longKeyLongPress定义像onClick吗? 这就是我的看法 TextViewxmlns:android="http://schemas.android.com/apk/res/android"android:text="Line 1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:
有什么办法定义为 XML布局longKeyLongPress定义像onClick吗?

这就是我的看法

<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:text="Line 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/message"
android:textSize="15dip"
android:textStyle="bold"
android:textColor="@color/colorblue"
android:shadowDy="1.0"
android:shadowDx="1.0"
android:shadowRadius="1.0"
android:shadowColor="#ffffffff"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="5dip"
android:lineSpacingExtra="3dip"
android:lineSpacingMultiplier="1.1"
android:singleLine="false"
android:autoLink="web|email|phone|map|all"

android:onClick="clickHandler"
android:clickable="true"

 />

我想要像以前一样的事情,但反应长时间的事件.

注意:

>我不想从我的代码添加监听器.
>我试过android:longClickable.

看目前的文档,这样一个XML参数当前不存在. longClickable是一个布尔参数,用于定义View是否响应长时间的点击.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读