我正在实现onTouchListener并将MainActivity其归因OnTouchListener于 Textview tv,但在运行时按下屏幕时不会弹出任何消息。
主要活动
public class MainActivity extends Activity implements View.OnTouchListener
{
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv=(TextView)findViewById(R.id.tv);
tv.setOnTouchListener(this);
tv.setText(R.string.hello);
}
public boolean onTouch(View v,MotionEvent event)
{
Toast.makeText(this,"onTouch",Toast.LENGTH_LONG).show();
return true;
}
}
Run Code Online (Sandbox Code Playgroud) 我在android中学习opencv,我想通过随机设置矩阵并打印出它的条目来试用Mat类.但是我不知道该怎么做,我失败很多次......我正在使用android pad和AIDE来做这个程序.
你能给我一个例子来帮助我吗?谢谢.