当前位置: 代码迷 >> Android >> android-slide-to-unlock 锁屏成效
  详细解决方案

android-slide-to-unlock 锁屏成效

热度:274   发布时间:2016-04-27 23:02:02.0
android-slide-to-unlock 锁屏效果

?

android-slide-to-unlock 锁屏效果,这是一个模仿苹果"slide to unlock"动画的demo应用。代码比较简单,就是用android自带的着色器shader去drawText,根据不同的参数,设置着色器不同的着色位置。。

运行效果:

?

?
完整源码下载地址:http://www.itlanbao.com/code/20150907/10000/100511.html
?
package com.stone.textview.slide;
?
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
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;
}
}
?
}
  相关解决方案