Android 手勢相關(一)

来源:https://www.cnblogs.com/zhjing/p/18103252
-Advertisement-
Play Games

Android 手勢相關(一) 本篇文章主要記錄下android 手勢相關的一些內容. Android 提供了一套強大的手勢識別框架,可以用來檢測和處理用戶的手勢操作. 1: 手勢識別 Android 提供了GestureDetector類來識別手勢,通過GestureDetector可以檢測用戶的 ...


Android 手勢相關(一)

本篇文章主要記錄下android 手勢相關的一些內容.

Android 提供了一套強大的手勢識別框架,可以用來檢測和處理用戶的手勢操作.

1: 手勢識別

Android 提供了GestureDetector類來識別手勢,通過GestureDetector可以檢測用戶的滑動,長按,雙擊等手勢操作.

2: 手勢監聽器

android 中處理手勢操作,需要我們實現GestureDetector.OnGestureListener介面,或者繼承GestureDetector.SimpleOnGestureListener.

這裡我們分開來講述下這兩種方式.

3: OnGestureListener介面

我們先實現下介面,添加列印日誌:

public class MyGesture implements GestureDetector.OnGestureListener {
    private static final String TAG = "MyGesture";

    @Override
    public boolean onDown(MotionEvent e) {
        Log.i(TAG, "onDown: "+e);
        return false;
    }

    @Override
    public void onShowPress(MotionEvent e) {
        Log.i(TAG, "onShowPress: "+e);
    }

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        Log.i(TAG, "onSingleTapUp: "+e);
        return false;
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        Log.i(TAG, "onScroll: " +e1+" "+e2);
        return false;
    }

    @Override
    public void onLongPress(MotionEvent e) {
        Log.i(TAG, "onLongPress: "+e);
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        Log.i(TAG, "onFling: "+e1 +" "+e2);
        return false;
    }
}
  1. onDown(): 手勢按下 MotionEvent.ACTION_DOWN
  2. onShowPress(): 用戶已經按下,但是還沒有執行移動/向上的移動操作.(這裡我們可以給出高亮顯示,增強顯示效果) MotionEvent.ACTION_DOWN
  3. onSingleTapUp(): 用戶手勢抬起時的動作. MotionEvent.ACTION_UP
  4. onScroll(): 屏幕滑動 包括兩個MotionEvent.ACTION_DOWN,MotionEvent.ACTION_MOVE
  5. onLongPress(): 長按 ACTION_DOWN
  6. onFling():迅速滑動

測試:

1: 手勢按下->抬起

onDown->onSingleTapUp

2024-03-27 11:22:18.236 6675-6675/? I/MyGesture: onDown: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=359.5007, y[0]=444.70743, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=175867619, downTime=175867619, deviceId=2, source=0x1002, displayId=0 }

2024-03-27 11:22:18.294 6675-6675/? I/MyGesture: onSingleTapUp: 
    MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=359.5007, y[0]=444.70743, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=175867683, downTime=175867619, deviceId=2, source=0x1002, displayId=0 }

2: 長按不抬起

onDown->onShowPress->onLongPress

2024-03-27 11:24:31.611 6675-6675/? I/MyGesture: onDown: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=550.2358, y[0]=541.6437, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176000997, downTime=176000997, deviceId=2, source=0x1002, displayId=0 }

2024-03-27 11:24:31.706 6675-6675/? I/MyGesture: onShowPress: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=550.2358, y[0]=541.6437, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176000997, downTime=176000997, deviceId=2, source=0x1002, displayId=0 }

2024-03-27 11:24:32.008 6675-6675/? I/MyGesture: onLongPress: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=550.2358, y[0]=541.6437, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176000997, downTime=176000997, deviceId=2, source=0x1002, displayId=0 }

3: 屏幕上來回滑動

onDown->onShowPress->onScroll->onScroll

2024-03-27 11:26:18.190 6675-6675/? I/MyGesture: onDown: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=146.79613, y[0]=707.53455, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176107576, downTime=176107576, deviceId=2, source=0x1002, displayId=0 }

2024-03-27 11:26:18.285 6675-6675/? I/MyGesture: onShowPress: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=146.79613, y[0]=707.53455, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176107576, downTime=176107576, deviceId=2, source=0x1002, displayId=0 }

2024-03-27 11:26:18.345 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=146.79613, y[0]=707.53455, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176107576, downTime=176107576, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=195.22885, y[0]=706.0355, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=176107730, downTime=176107576, deviceId=2, source=0x1002, displayId=0 }


2024-03-27 11:26:18.361 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=146.79613, y[0]=707.53455, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176107576, downTime=176107576, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=245.15952, y[0]=705.03613, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=176107747, downTime=176107576, deviceId=2, source=0x1002, displayId=0 }

4: 快速划過

onDown->onScroll->onScroll->onFling

2024-03-27 11:28:58.135 6675-6675/? I/MyGesture: onDown: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:28:58.170 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=361.2865, y[0]=554.5809, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=3, eventTime=176267556, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:28:58.187 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=519.8522, y[0]=535.2958, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=176267573, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:28:58.204 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=681.7713, y[0]=530.18, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=176267589, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:28:58.210 6675-6675/? I/MyGesture: onScroll: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=718.0028, y[0]=530.6509, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267593, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:28:58.210 6675-6675/? I/MyGesture: onFling: 
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=185.74203, y[0]=596.6075, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267521, downTime=176267521, deviceId=2, source=0x1002, displayId=0 } 
    MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=718.0028, y[0]=530.6509, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=176267600, downTime=176267521, deviceId=2, source=0x1002, displayId=0 }

4: SimpleOnGestureListener類

繼承SimpleOnGestureListener,代碼如下:

public class MyGesture2 extends GestureDetector.SimpleOnGestureListener {
    private static final String TAG = "MyGesture2";
    @Override
    public boolean onDown(MotionEvent e) {
        Log.i(TAG, "onDown:\n"+e);
        return super.onDown(e);
    }

    @Override
    public void onShowPress(MotionEvent e) {
        Log.i(TAG, "onShowPress:\n"+e);
        super.onShowPress(e);
    }

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        Log.i(TAG, "onSingleTapUp:\n"+e);
        return super.onSingleTapUp(e);
    }

    @Override
    public void onLongPress(MotionEvent e) {
        Log.i(TAG, "onLongPress:\n"+e);
        super.onLongPress(e);
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        Log.i(TAG, "onScroll:\n"+e1+"\n"+e2+"\n");
        return super.onScroll(e1, e2, distanceX, distanceY);
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        Log.i(TAG, "onFling:\n"+e1+"\n"+e2+"\n");
        return super.onFling(e1, e2, velocityX, velocityY);
    }

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        Log.i(TAG, "onDoubleTap:\n"+e);
        return super.onDoubleTap(e);
    }

    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        Log.i(TAG, "onDoubleTapEvent:\n"+e);
        return super.onDoubleTapEvent(e);
    }

    @Override
    public boolean onContextClick(MotionEvent e) {
        Log.i(TAG, "onContextClick:\n"+e);
        return super.onContextClick(e);
    }

    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        Log.i(TAG, "onSingleTapConfirmed:\n"+e);
        return super.onSingleTapConfirmed(e);
    }

}

SimpleOnGestureListener類實際上繼承了OnGestureListener, OnDoubleTapListener, OnContextClickListener這三個介面.

這裡我們只需要關註OnDoubleTapListener以及OnContextClickListener即可.

  1. onSingleTapConfirmed():用戶在屏幕上進行了單擊操作
  2. onDoubleTap(): 發生雙擊時 , 參數MotionEvent代表的是第一次向下點擊的事件
  3. onDoubleTapEvent():雙擊手勢發生時發出的通知, MotionEvent可以是向下,移動,向上.
  4. onContextClick():

測試:

1.手勢按下->抬起

onDown->onSingleTapUp->onSingleTapConfirmed

2024-03-27 11:53:46.537 9897-9897/? I/MyGesture2: onDown:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=380.4716, y[0]=401.73572, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177755922, downTime=177755922, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:53:46.596 9897-9897/? I/MyGesture2: onSingleTapUp:
    MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=380.4716, y[0]=401.73572, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177755985, downTime=177755922, deviceId=2, source=0x1002, displayId=0 }
2024-03-27 11:53:46.837 9897-9897/? I/MyGesture2: onSingleTapConfirmed:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=380.4716, y[0]=401.73572, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177755922, downTime=177755922, deviceId=2, source=0x1002, displayId=0 }

2: 雙擊

onDown->onSingleTapUp->onDoubleTap(ACTION_DOWN)->onDoubleTapEvent(ACTION_DOWN)

->onDown->onDoubleTapEvent(ACTION_MOVE)->onDoubleTapEvent(ACTION_MOVE)->onDoubleTapEvent(ACTION_UP)

2024-03-24 11:48:03.028 9897-9897/? I/MyGesture2: onDown:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=387.46185, y[0]=547.6397, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412412, downTime=177412412, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.071 9897-9897/? I/MyGesture2: onSingleTapUp:
    MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=387.46185, y[0]=547.6397, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412459, downTime=177412412, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.311 9897-9897/? I/MyGesture2: onDoubleTap:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=387.46185, y[0]=547.6397, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412412, downTime=177412412, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.312 9897-9897/? I/MyGesture2: onDoubleTapEvent:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412698, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.313 9897-9897/? I/MyGesture2: onDown:
    MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412698, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.332 9897-9897/? I/MyGesture2: onDoubleTapEvent:
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=177412715, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.348 9897-9897/? I/MyGesture2: onDoubleTapEvent:
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=177412733, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.355 9897-9897/? I/MyGesture2: onDoubleTapEvent:
    MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412738, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }
2024-03-24 11:48:03.356 9897-9897/? I/MyGesture2: onDoubleTapEvent:
    MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=384.46603, y[0]=527.6529, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=177412744, downTime=177412698, deviceId=2, source=0x1002, displayId=0 }

本文由博客一文多發平臺 OpenWrite 發佈!


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在金融行業數字化轉型背景下,銀行等金融機構面臨著業務模式創新與數據應用的深度融合。業務上所需要的不再是單純的數據,而是數據背後映射的業務趨勢洞察,只有和業務相結合轉化為業務度量指標,經過數據分析處理呈現為報表進行展示,才能真正體現它們的價值。 但在需求轉化為指標的過程中,存在需求管理雜亂、登記維護難 ...
  • 企業搭建完善、全面的指標體系是企業用數據指導業務經營決策的第一步。但是做完指標之後,對指標的監控,經常被大家忽視。當指標發生了異常波動(上升或下降),需要企業能夠及時發現,並快速找到背後真實的原因,才能針對性地制定相應策略,否則就是盲打,原地打轉。 指標異常波動的具體場景,比如: · 企業關鍵詞的搜 ...
  • 【Pavia】遙感圖像數據集下載地址和讀取數據集代碼 目錄【Pavia】遙感圖像數據集下載地址和讀取數據集代碼前言Pavia數據集Pavia數據集地址:Pavia數據集預覽PaviaU.matPaviaU_gt.matPavia數據集的Matlab讀取方式Pavia數據集中PaviaU.mat的ma ...
  • 要求統計所有分類下的數量,如果分類下沒有對應的數據也要展示。這種問題在日常的開發中很常見,每次寫每次忘,所以在此記錄下。 這種統計往往不能直接group by,因為有些類別可能沒有對應的數據 這裡有兩個思路(如果您有更好的方法,請一定要告訴我,求求了): 每種類型分別統計,用union 連接(比較適 ...
  • 一、Button Button(按鈕)是一種常見的用戶界面控制項,通常用於觸發操作或提交數據。Button 擁有文本標簽和一個可點擊的區域,用戶點擊該區域即可觸發相應的操作或事件。 Button 的主要功能有: 觸發操作:用戶點擊 Button 可以觸發相應的操作,例如提交表單、搜索、切換頁面等。 ...
  • 一、Swiper 1.概述 Swiper可以實現手機、平板等移動端設備上的圖片輪播效果,支持無縫輪播、自動播放、響應式佈局等功能。Swiper輪播圖具有使用簡單、樣式可定製、功能豐富、相容性好等優點,是很多網站和移動應用中常用的輪播圖插件。 2.佈局與約束 Swiper是一個容器組件,如 ...
  • 一、Grid/GridItem 1.概述 網格佈局是一種新型的佈局方式,它按照網格來劃分頁面,通過列和行來定義網格,使得頁面的佈局更加靈活、簡潔、易於維護。網格佈局能夠將頁面分成多個單元格,可以在這些單元格中佈置各種元素,例如文本、圖片、媒體等,從而實現頁面的排版。網格佈局支持自適應佈局,能 ...
  • Android 手勢相關(二) 本篇文章繼續記錄下android 手勢相關的內容. 1: GestureOverlayView簡介 GestureOverlayView是Android中的一個視圖組件,用於捕捉和處理手勢操作. GestureOverlayView的主要用途: 手勢識別: 通過Ges ...
一周排行
    -Advertisement-
    Play Games
  • .Net8.0 Blazor Hybird 桌面端 (WPF/Winform) 實測可以完整運行在 win7sp1/win10/win11. 如果用其他工具打包,還可以運行在mac/linux下, 傳送門BlazorHybrid 發佈為無依賴包方式 安裝 WebView2Runtime 1.57 M ...
  • 目錄前言PostgreSql安裝測試額外Nuget安裝Person.cs模擬運行Navicate連postgresql解決方案Garnet為什麼要選擇Garnet而不是RedisRedis不再開源Windows版的Redis是由微軟維護的Windows Redis版本老舊,後續可能不再更新Garne ...
  • C#TMS系統代碼-聯表報表學習 領導被裁了之後很快就有人上任了,幾乎是無縫銜接,很難讓我不想到這早就決定好了。我的職責沒有任何變化。感受下來這個系統封裝程度很高,我只要會調用方法就行。這個系統交付之後不會有太多問題,更多應該是做小需求,有大的開發任務應該也是第二期的事,嗯?怎麼感覺我變成運維了?而 ...
  • 我在隨筆《EAV模型(實體-屬性-值)的設計和低代碼的處理方案(1)》中介紹了一些基本的EAV模型設計知識和基於Winform場景下低代碼(或者說無代碼)的一些實現思路,在本篇隨筆中,我們來分析一下這種針對通用業務,且只需定義就能構建業務模塊存儲和界面的解決方案,其中的數據查詢處理的操作。 ...
  • 對某個遠程伺服器啟用和設置NTP服務(Windows系統) 打開註冊表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer 將 Enabled 的值設置為 1,這將啟用NTP伺服器功 ...
  • title: Django信號與擴展:深入理解與實踐 date: 2024/5/15 22:40:52 updated: 2024/5/15 22:40:52 categories: 後端開發 tags: Django 信號 松耦合 觀察者 擴展 安全 性能 第一部分:Django信號基礎 Djan ...
  • 使用xadmin2遇到的問題&解決 環境配置: 使用的模塊版本: 關聯的包 Django 3.2.15 mysqlclient 2.2.4 xadmin 2.0.1 django-crispy-forms >= 1.6.0 django-import-export >= 0.5.1 django-r ...
  • 今天我打算整點兒不一樣的內容,通過之前學習的TransformerMap和LazyMap鏈,想搞點不一樣的,所以我關註了另外一條鏈DefaultedMap鏈,主要調用鏈為: 調用鏈詳細描述: ObjectInputStream.readObject() DefaultedMap.readObject ...
  • 後端應用級開發者該如何擁抱 AI GC?就是在這樣的一個大的浪潮下,我們的傳統的應用級開發者。我們該如何選擇職業或者是如何去快速轉型,跟上這樣的一個行業的一個浪潮? 0 AI金字塔模型 越往上它的整個難度就是職業機會也好,或者說是整個的這個運作也好,它的難度會越大,然後越往下機會就會越多,所以這是一 ...
  • @Autowired是Spring框架提供的註解,@Resource是Java EE 5規範提供的註解。 @Autowired預設按照類型自動裝配,而@Resource預設按照名稱自動裝配。 @Autowired支持@Qualifier註解來指定裝配哪一個具有相同類型的bean,而@Resourc... ...