Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android文本视图和setTextIsSelectable_Android_Textview - Fatal编程技术网

Android文本视图和setTextIsSelectable

Android文本视图和setTextIsSelectable,android,textview,Android,Textview,我正在做一个简单的15字谜游戏。我为每个块设置了TextView,所有15个块都是动态添加的。我想在布局中触摸并移动TextView。我有一个相对论你。我已经完成了块的移动,但有时会选择块内的文本。我尝试了t.setTextIsSelectable(false)但此时,触摸监听器不工作。这个问题有解决办法吗。下面显示的是来自应用程序的代码片段 /* Create the text view */ TextView t = new TextView(this);

我正在做一个简单的15字谜游戏。我为每个块设置了
TextView
,所有15个块都是动态添加的。我想在布局中触摸并移动
TextView
。我有一个
相对论你
。我已经完成了块的移动,但有时会选择块内的文本。我尝试了
t.setTextIsSelectable(false)但此时,触摸监听器不工作。这个问题有解决办法吗。下面显示的是来自应用程序的代码片段

/* Create the text view */
        TextView t = new TextView(this);

        /* Configure the text view */
        t.setLayoutParams(params);
        t.setTextIsSelectable(true);
        t.setTextColor(Color.BLACK);
        t.setGravity(Gravity.CENTER);
        t.setBackgroundResource(R.drawable.wood);
        t.setTextSize(TypedValue.COMPLEX_UNIT_SP, 42);
        t.setText(Integer.toString(j * R_BLOCKS + i + 1));
        t.setOnTouchListener(touchListener);

        /* Add to layout */
        l.addView(t);
为什么不用纽扣呢? 因为你用你自己的抽绳来剥皮。使用
TextView
按钮
无法区分两者之间的区别

按钮
s用于单击,而
文本视图
s用于保存文本,因此使用
按钮
s可能会更轻松。

为什么不使用按钮? 因为你用你自己的抽绳来剥皮。使用
TextView
按钮
无法区分两者之间的区别

按钮
s用于单击,而
文本视图
s用于保存文本,因此使用
按钮
s可能会更轻松