android-slide-to-unlock 鎖屏效果,這是一個模仿蘋果"slide to unlock"動畫的demo應用。代碼比較簡單,就是用android自帶的着色器shader去drawText,根據不一樣的參數,設置着色器不一樣的着色位置。。html
完整源碼下載地址:http://www.itlanbao.com/code/20150907/10000/100511.htmlandroid
package com.stone.textview.slide;app
import android.os.Bundle;ide
import android.support.v4.app.Fragment;動畫
import android.support.v4.app.FragmentActivity;spa
import android.view.LayoutInflater;code
import android.view.View;htm
import android.view.ViewGroup;get
import android.view.Window;源碼
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
return rootView;
}
}
}