Android开发之触摸事件-点击屏幕获…
来源:互联网 发布:python 期货 编辑:程序博客网 时间:2024/04/28 10:52
.xml文件
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
</LinearLayout>
.java文件
packagecom.example.touchproject;
importandroid.os.Bundle;
importandroid.app.Activity;
importandroid.view.Menu;
importandroid.view.MotionEvent;
importandroid.view.View;
importandroid.view.View.OnTouchListener;
importandroid.widget.TextView;
public class MainActivityextends Activity {
private TextViewinfo=null;
protected void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.info=(TextView)super.findViewById(R.id.info);
//添加触摸事件
this.info.setOnTouchListener(newTouchListenerImp());
}
private class TouchListenerImpimplements OnTouchListener{
public boolean onTouch(View v,MotionEvent event) {
MainActivity.this.info.setText("x="+event.getX()+"y="+event.getY());
return false;
}
}
}
0 0
- Android开发之触摸事件-点击屏幕获…
- 【Android】技术调研:用代码模拟屏幕点击、触摸事件
- 【Android】技术调研:用代码模拟屏幕点击、触摸事件
- android中屏幕触摸事件
- android屏幕触摸事件机制
- android屏幕触摸事件机制
- android屏幕触摸事件机制
- android 屏幕触摸事件机制
- Android开发之触摸事件的使用--触…
- IOS开发之触摸与点击事件:UITapGestureRecognizer应用
- android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- Android 触摸事件、点击事件的区别
- android 触摸事件、点击事件的区别
- Android开发之焦点事件的使用
- Android开发之长按事件的--改变桌…
- Android开发之正则表达式的使用1
- Android正则表达式2
- Android开发之键盘事件,验证邮箱…
- Android开发之触摸事件-点击屏幕获…
- Android开发之触摸事件的使用--触…
- MFC+ ACCESS 数据库程序移植到客户机出现ERROR CODE 80004003 解决方案
- html5当中支持的视频格式
- html5开发<video>视频标签的使用--…
- html5之<video>开发实现音乐播放控…
- 如何解决谷歌浏览器Origin nu…
- html5开发<video>视频字幕的程序
- html5中视频的播放帧率