android仿騰訊安全管家首頁抽屜效果

2021-09-01 14:46:04 字數 1901 閱讀 5032

[img]

雖然android 文件中向我們提供了乙個叫slidingdrawer的抽屜組建,但是這個組建的使用限制比較多,也實現不了我們想要的效果。故到網上搜了一會,也沒看到有開發者寫這樣的組建。所以只能靠自己了,但是在網上還是看到了一下有價值的參考案例。

不費話了,直接上實現後的效果圖:

[img]

下面是自定義組建的實現**

import android.content.context;

import android.os.asynctask;

import android.util.log;

import android.view.gesturedetector;

import android.view.motionevent;

import android.view.view;

import android.widget.button;

import android.widget.linearlayout;

public class customslidingdrawer extends linearlayout implements gesturedetector.ongesturelistener, view.ontouchlistener

/*** 把view放在customslidingdrawer的container

* @param v

*/public void fillpanelcontainer(view v)

/*** 非同步移動customslidingdrawer

*/class asynmove extends asynctask

return null;

}@override

protected void onprogressupdate(integer... params)

}@override

public boolean ondown(motionevent e)

@override

public boolean onsingletapup(motionevent e) );// 正數展開

else if (lp.bottommargin >= 0)

new asynmove().execute(new integer );// 負數收縮

return false;

}@override

public boolean onscroll(motionevent e1, motionevent e2, float distancex,

float distancey) else if (lp.bottommargin > -(mbottonmargin) && mscrolly < 0)

return false;

}@override

public boolean onfling(motionevent e1, motionevent e2, float velocityx,

float velocityy)

@override

public void onlongpress(motionevent e) {}

@override

public void onshowpress(motionevent e) {}

@override

public boolean ontouch(view v, motionevent event) );// 正數展開

} else if (lp.bottommargin < (-mbottonmargin/2)) );// 負數收縮}}

return mgesturedetector.ontouchevent(event);

}}

下面是demo的原始碼:

仿騰訊登入驗證碼

protected void page load object sender,eventargs e protected static int vcode length 4 private static readonly int width 80,height 35 字型集 private stat...

android 仿花椒送花效果

今天寫乙個單個的,明天寫乙個很多那種花向上運動的效果,單個的很簡單,就是繪製乙個二階或者三階貝塞爾曲線,然後不斷的去改變這個離曲線起點位置的值,就可以求出座標,這個都是api給我們提供好了的,我們只負責調就行,如果對path不熟悉的話,要先去看下path是怎麼回事,path是在繪製界是很重要的乙個類...

Android仿芝麻信用分

1.先準備好 2.新建乙個creditscoreview類,繼承view public class creditscoreview extends view 各維度圖示 private int icons 各維度分值 private float data 資料最大值 private float ma...