Android自定义观点实现随手势滑动控件

  

本文控件为大家分享了Android随手势滑动控件的具体代码,供大家参考,具体内容如下

  

<强> 1。新建自定义控件类:MyView

        公开课MyView扩展按钮{//记录上次滑动后的坐标值   私人int lastX;   私人int lastY;      公共MyView(上下文语境){   超级(上下文);//TODO自动生成构造函数存根   }   公共MyView(上下文语境,AttributeSet attrs) {      超级(上下文,attrs);   }      @Override   公共布尔>   & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; RelativeLayout xmlns: android=" http://schemas.android.com/apk/res/android "   xmlns:工具=" http://schemas.android.com/tools "   android: layout_width=" match_parent "   android: layout_height=" match_parent "   比;      & lt; com.example.administrator.slide.MyView   android: id=癅 + id/myview”   android: layout_width=" wrap_content "   android: layout_height=" wrap_content "   android:文本="我可以滑动”/比;      & lt;/RelativeLayout>   之前      

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
  

Android自定义观点实现随手势滑动控件