android 项目学习随笔一(闪屏 )
1、取标题栏且全屏
<activity
android:name="com.ecollab.zhsh66.SplashActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
2、代码取掉标题
requestWindowFeature(Window.FEATURE_NO_TITLE);必须在setContentView(R.layout.activity_main);之前执行
3、整体旋转、缩放、渐变
public class SplashActivity extends Activity {
private RelativeLayout rlRoot;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
rlRoot = (RelativeLayout) findViewById(R.id.rl_root);
// 旋转, 缩放, 渐变
// 旋转
RotateAnimation animRotate = new RotateAnimation(0, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
animRotate.setDuration(1000);
animRotate.setFillAfter(true);
// 缩放
ScaleAnimation animScale = new ScaleAnimation(0, 1, 0, 1,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
animScale.setDuration(1000);
animScale.setFillAfter(true);
// 渐变
AlphaAnimation animAlpha = new AlphaAnimation(0, 1);
animAlpha.setDuration(2000);
animAlpha.setFillAfter(true);
// 动画集合
AnimationSet animSet = new AnimationSet(true);
animSet.addAnimation(animRotate);
animSet.addAnimation(animScale);
animSet.addAnimation(animAlpha);
rlRoot.startAnimation(animSet);
animSet.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// 判断是否需要跳到新手引导
boolean isGuideShow = PrefUtils.getBoolean("is_guide_show",
false, getApplicationContext());
if (isGuideShow) {
// 动画结束后跳主页面
startActivity(new Intent(getApplicationContext(),
MainActivity.class));
} else {
// 跳到新手引导
startActivity(new Intent(getApplicationContext(),
GuideActivity.class));
}
finish();
}
});
}
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash_bg_newyear" > <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/splash_horse_newyear" /> </RelativeLayout>
android 项目学习随笔一(闪屏 )的更多相关文章
- android 项目学习随笔十八(三级缓存)
xUtils的BitmapUtils模块用的就是三级缓存,在项目中尽量还是应用BitmapUtils 三级缓存(机制) import com.itheima.zhsh66.R; import andr ...
- android 项目学习随笔二十一(IM、语音识别、机器人、统计、扫描二维码、条形码)
语音识别:科大讯飞语音云 http://www.xfyun.cn/ 语音机器人模拟 public class TalkBean { public String text; public boolean ...
- android 项目学习随笔二十(屏幕适配)
1.图片适配 放入相同名称的资源文件,机器根据不同分辨率找相近的资源 240*320 ldpi 320*480 mdpi 480*800 hdpi 720*1280 xhdpi 2.布局适配 在不同的 ...
- android 项目学习随笔十七(ListView、GridView显示组图)
ListView.GridView显示组图,处理机制相同 <?xml version="1.0" encoding="utf-8"?> <Li ...
- android 项目学习随笔十六( 广告轮播条播放)
广告轮播条播放 if (mHandler == null) {//在此初始化mHandler , 保证消息不重复发送 mHandler = new Handler() { public void ha ...
- android 项目学习随笔十四(WebView)
1.布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro ...
- android 项目学习随笔十三(ListView实现ITEM点击事件,将已读状态持久化到本地)
1.因为给LISTVIEW增加了两个头布局,所以在点击事件ITEM索引会增加2,比如原来第一条数据的索引应该为0,增加两个头布局后,它的索引变为 2,为了使LISTVIEW的ITEM在点 ...
- android 项目学习随笔十二(ListView加脚布局)
1.ListView加脚布局 头布局initHeaderView,在onTouchEvent事件中进行显示隐藏头布局切换 脚布局initFooterView,实现接口OnScrollListener, ...
- android 项目学习随笔十一(ListView下拉刷新提示)
1. 设置mHeaderView.setPadding TOPPADING为负值,隐藏刷新提示头布局 在onTouchEvent事件中进行头布局显示隐藏切换 import java.text.Simp ...
随机推荐
- c#基础,面试前迅速巩固c#最基础知识点
n年前为了面试,搜罗的C#基础知识,记在了文档里.今天写到博客园里,与人分享,因为不是专家,所以仅供参考. 1.面向对象 在面向对象概念提出之前,语言都是面向过程的,说到面向对象,应该与面向过程比较, ...
- boost.compressed_pair源码剖析
意义 当compressed_pair的某一个模板参数为一个空类的时候将对其进行“空基类优化”,这样可以使得compressed_pair占用的空间比std::pair的更小. 参考如下代码: #in ...
- grok
http://udn.yyuap.com/doc/logstash-best-practice-cn/filter/grok.html
- Apple Developer Program Roles Overview
Apple Developer Program Roles Overview There are three roles that can be assigned to Apple Developer ...
- SqlServer基础:Bit类型
SqlServer的bit类是只0或者1,默认不输入值时为null,但是如果输入的值不是0和1时,则默认填充的值为1
- Mysql-5.6.30卸载
Mysql-5.6.30卸载 一.删除相关文件 rm -rf /var/lib/mysql/mysql (删除数据文件) rm -f /root/.mysql_secure (删除缺 ...
- 构建LINUX下的入侵检测系统——LIDS 系统管理命令--vlock
构建LINUX下的入侵检测系统——LIDS 系统管理命令--vlock http://blog.chinaunix.net/uid-306663-id-2440200.html LIDS官方网站: ...
- 经过各种坑之后centos+ uwsgi + nginx +django 终于配好了
https://pypi.python.org/pypi/setuptools#downloads https://www.python.org/ftp/python/ 开机 加入 uwsgi ngi ...
- scp与rsync限速
一/scp限速1M #scp -l 1000 文件名 账号@远程机器IP此时的传输速率就是1M/8=100K左右 二/rsync是(限制为 100k Bytes/s): #rsync -auvzP-- ...
- 指向函数的指针与iOS-Block相关知识
指向函数的指针与iOS-Block相关知识 一. 函数指针的定义和调用: 关于函数指针的知识详细可参考:http://www.cnblogs.com/mjios/archive/2013/03/19/ ...