把设置里的USB调试重新开了开,问题解决!
GestureDetector类定义了许多触摸事件。包括
1.boolean onDoubleTap(MotionEvent e)解释:双击的第二下Touch down时触发
2.boolean onDoubleTapEvent(MotionEvent e)解释:双击的第二下Touch down和up都会触发,可用e.getAction()区分。
3.boolean onDown(MotionEvent e)解释:Touch down时触发
4.boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)解释:Touch了滑动一点距离后,up时触发。
5.void onLongPress(MotionEvent e)解释:Touch了不移动一直Touch down时触发
6.boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)解释:Touch了滑动时触发。
7.void onShowPress(MotionEvent e)解释:Touch了还没有滑动时触发(与onDown,onLongPress)比较onDown只要Touch down一定立刻触发。而Touchdown后过一会没有滑动先触发onShowPress再是onLongPress。所以Touchdown后一直不 滑动,onDown->onShowPress->onLongPress这个顺序触发。
8.boolean onSingleTapConfirmed(MotionEvent e)
9.boolean onSingleTapUp(MotionEvent e)解释:上面这两个函数都是在touch down后又没有滑动(onScroll),又没有长按(onLongPress),然后Touchup时触发。
点击一下非常快的(不滑动)Touchup:onDown->onSingleTapUp->onSingleTapConfirmed
点击一下稍微慢点的(不滑 动)Touchup:onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
GestureDetector探测当前用户各种不同的操作手势,通过 GestureDetector.OnGestureListener callback来获取当前被触发的操作手势(Single Tap Up、Show Press、Long Press、Scroll、Down、Fling)。
使用方法:
01.private GestureDetector mGestureDetector;
02.@Override
03.public void onCreate(Bundle savedInstanceState) {
04. super.onCreate(savedInstanceState);
05. mGestureDetector = new GestureDetector(this, new LearnGestureListener());
06.}
07.@Override
08.public boolean onTouchEvent(MotionEvent event) {
09. if (mGestureDetector.onTouchEvent(event))
10. return true;
11. else
12. return false;
13.}
14.class LearnGestureListener extends GestureDetector.SimpleOnGestureListener{
15. @Override
16. public boolean onSingleTapUp(MotionEvent ev) {
17. Log.d("onSingleTapUp",ev.toString());
18. return true;
19. }
20. @Override
21. public void onShowPress(MotionEvent ev) {
22. Log.d("onShowPress",ev.toString());
23. }
24. @Override
25. public void onLongPress(MotionEvent ev) {
26. Log.d("onLongPress",ev.toString());
27. }
28. @Override
29. public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
30. Log.d("onScroll",e1.toString());
31. return true;
32. }
33. @Override
34. public boolean onDown(MotionEvent ev) {
35. Log.d("onDownd",ev.toString());
36. return true;
37. }
38. @Override
39. public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
40. Log.d("d",e1.toString());
41. Log.d("e2",e2.toString());
42. return true;
43. }
44.}
说明:
在当前类中创建一个GestureDetector实例。
1.private GestureDetector mGestureDetector;
创建一个Listener来实时监听当前面板操作手势。
1.class LearnGestureListener extends GestureDetector.SimpleOnGestureListener
在初始化时,将Listener实例关联当前的GestureDetector实例。
1.mGestureDetector = new GestureDetector(this, new LearnGestureListener());
利用onTouchEvent方法作为入口检测,通过传递MotionEvent参数来监听操作手势。
1.mGestureDetector.onTouchEvent(event)
LTRIM、RTRIM和TRIM在ORACLE中的用法:
1、LTRIM(C1,C2)
其中C1和C2都可以字符串,例如C1是'Miss Liu',C2'MisL'等等。这是第一个和SQL SERVER不一样的地方。如果记得不错的话SQL Server的LTRIM只有一个参数,作用是去掉字符串左面的空格。而Oracle的LTRIM则是保证C1的第一个字符不能出现在C2字符串中。
SQL> select LTRIM( 'Miss Liu', 'Liu') Result from dual;
RESULT
--------
Miss Liu
SQL> select LTRIM( 'Miss Liu', 'M is') result from dual;
RES
---
Liu
从上述就可以看出LTRIM的作用。但是如果第二个字符串不进行输入,那么LTRIM的作用和SQL SERVER中就相同,就是去掉左面的空格。
SQL> select ltrim( ' Miss Liu ' ) result from dual;
RESULT
----------
Miss Liu
SQL> select length( ' Miss Liu ' ) len1, length( ltrim( ' Miss Liu ' ) ) lentrim from dual;
LEN1 LENTRIM
---------- ----------
12 10
由上述可以看出Oracle的LTrim的功能应该更强大一些,能够对前导符进行操作。
2、RTRIM的功用和LTRIM相同,但是RTRIM修改成了从右向左的,这样子就是去掉后导符中的特定字符。
3、TRIM的功能如下描述:
In Oracle/PLSQL, the trim function removes all specified characters either from the beginning or the ending of a string.
The syntax for the trim function is:
trim( [ leading | trailing | both [ trim_character ] ] string1 )
leading - remove trim_string from the front of string1.
trailing - remove trim_string from the end of string1.
both - remove trim_string from the front and end of string1.
If none of these are chosen (ie: leading, trailing, both), the trim function will remove trim_string from both the front and end of string1.
trim_character is the character that will be removed from string1. If this parameter is omitted, the trim function will remove all leading and trailing spaces from string1.
string1 is the string to trim.
trim(' tech ') would return 'tech'
trim(' ' from ' tech ') would return 'tech'
trim(leading '0' from '000123') would return '123'
trim(trailing '1' from 'Tech1') would return 'Tech'
trim(both '1' from '123Tech111') would return '23Tech
上面的这些都已经被验证了,其中leading trailing和Both后面的From不可省略