你好,游客 登录 注册 搜索
背景:
阅读新闻

Android的gesture的识别和自定义gesture

[日期:2011-12-11] 来源:Linux社区  作者:alex0203 [字体:大 中 小]

create_gesture.xml\

  1. <?xml version="1.0" encoding="utf-8"?>  
  2.   
  3. <LinearLayout  
  4.     xmlns:Android="http://schemas.android.com/apk/res/android"  
  5.   
  6.     android:layout_width="match_parent"  
  7.     android:layout_height="match_parent"  
  8.       
  9.     android:orientation="vertical">  
  10.   
  11.     <LinearLayout  
  12.         android:layout_width="match_parent"  
  13.         android:layout_height="wrap_content"  
  14.         android:orientation="horizontal">  
  15.       
  16.         <TextView  
  17.             android:layout_width="wrap_content"  
  18.             android:layout_height="wrap_content"  
  19.             android:layout_marginRight="6dip"  
  20.             android:text="prompt_gesture_name"  
  21.             android:textAppearance="?android:attr/textAppearanceMedium" />  
  22.           
  23.         <EditText  
  24.             android:id="@+id/gesture_name"  
  25.             android:layout_width="0dip"  
  26.             android:layout_weight="1.0"  
  27.             android:layout_height="wrap_content"  
  28.             android:maxLength="40"  
  29.             android:singleLine="true" />  
  30.   
  31.     </LinearLayout>  
  32.       
  33.     <android.gesture.GestureOverlayView  
  34.         android:id="@+id/gestures_overlay"  
  35.         android:layout_width="match_parent"  
  36.         android:layout_height="0dip"  
  37.         android:layout_weight="1.0"  
  38.         android:gestureStrokeType="multiple" />  
  39.   
  40.     <LinearLayout  
  41.         style="@android:style/ButtonBar"  
  42.         android:layout_width="match_parent"  
  43.         android:layout_height="wrap_content"  
  44.         android:orientation="horizontal">  
  45.   
  46.         <Button  
  47.             android:id="@+id/done"  
  48.             android:layout_width="0dip"  
  49.             android:layout_height="wrap_content"  
  50.             android:layout_weight="1"  
  51.             android:enabled="false"  
  52.             android:onClick="addGesture"  
  53.             android:text="button_done" />  
  54.       
  55.         <Button  
  56.             android:layout_width="0dip"  
  57.             android:layout_height="wrap_content"  
  58.             android:layout_weight="1"  
  59.             android:onClick="cancelGesture"  
  60.             android:text="button_discard" />  
  61.       
  62.     </LinearLayout>  
  63.       
  64. </LinearLayout>  

注意,不要忘记,写入手势时,一定要增加权限,写入sd卡

  1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
linux
相关资讯       Android开发教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款