我正在实现并将 an 归因onTouchListener
于Textview ,但是当按下屏幕时运行时没有弹出消息。MainActivity
OnTouchListener
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;
}
}