使Android的TextView或可选择的EditText [英] make Android Textview or EditText selectable

查看:585
本文介绍了使Android的TextView或可选择的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要让的EditText 的TextView 选择在我的Andr​​oid项目。
项目是Android 4.0以上版本。我补充一点: txtView.setTextIsSelectable(真)也: txtView.setCustomSelectionActionModeCallback(新myCallBack函数());
使我的自定义选择菜单。
但这个错误happend当我要选择文本。

  W / TextView中:TextView中不支持文本选择。动作方式取消。

我搜索有关该错误的,但没有找到。什么应该怎么办解决?


解决方案

 <的TextView
    机器人:ID =@ + D / I
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:textIsSelectable =真
    机器人:文字=/>

* API级别11和仅占

I want to make EditText or Textview selectable in my android project . project is for android 4.0+ . I add this : txtView.setTextIsSelectable(true) and also : txtView.setCustomSelectionActionModeCallback(new myCallback()); to make my custom selection menu . but this error happend when i want to select the text .

W/TextView﹕ TextView does not support text selection. Action mode cancelled.

i searched about the error but didn't find the solution .what should i do ?

解决方案

<TextView
    android:id="@+id/id
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textIsSelectable="true"
    android:text="" />

*API Level 11 and up only

这篇关于使Android的TextView或可选择的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆