編輯:關於Android編程
Flip Animation for Android:
最近項目中用到了一個小動畫,讓物體實現一定的3D旋轉效果,現記錄如下:
public class FlipAnimation extends Animation { private Camera mCamera; private View mFromView; private View mToView; private float mCenterX; private float mCenterY; private boolean mForward = true; /** * Creates a 3D flip animation between two views. * * @param fromView First view in the transition. * @param toView Second view in the transition. */ public FlipAnimation(View fromView, View toView) { mFromView = fromView; mToView = toView; setDuration(700); setFillAfter(false); setInterpolator(new AccelerateDecelerateInterpolator()); } public void reverse() { mForward = false; View switchView = mToView; mToView = mFromView; mFromView = switchView; } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); mCenterX = width / 2; mCenterY = height / 2; mCamera = new Camera(); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { final double radians = Math.PI * interpolatedTime; float degrees = (float)(180.0 * radians / Math.PI); if (interpolatedTime >= 0.5f) { degrees -= 180.f; mFromView.setVisibility(View.GONE); mToView.setVisibility(View.VISIBLE); } if (mForward) { degrees = -degrees; } final Matrix matrix = t.getMatrix(); mCamera.save(); mCamera.rotateY(degrees); mCamera.getMatrix(matrix); mCamera.restore(); matrix.preTranslate(-mCenterX, -mCenterY); matrix.postTranslate(mCenterX, mCenterY); } }
隨著公司新業務的起步由於原有APP_A的包已經很大了,所以上邊要求另外開發一款APP_B,要求是APP_A和APP_B賬號通用且兩個APP可以相互打開。賬號通用也就是說在
Android中圖案解鎖首先要理解圖案的實現原理,上一張圖: 由上圖,可以看出,圖案中手勢的記錄是1-9或0-8的,保存的順序就是密碼,當然有些是可以重復的,為了安全,
今天github 排行榜上突然出現了 谷歌最新推出的Android 最新控件FlexboxLayout 。 FlexboxLayout究竟是什麼東西
實驗中只需要編寫相應的xml的代碼,java代碼不需要更改,因為我們這裡只是練習android的界面設計。線性布局:線性布局就是將各種控件按照行或者列依次進行排列。其中本