android 项目学习随笔一(闪屏 )
来源:互联网 发布:重做系统数据恢复 编辑:程序博客网 时间:2024/05/21 23:58
1、取标题栏且全屏View CodeView Code
<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>
0 0
- android 项目学习随笔一(闪屏 )
- android 项目学习随笔三(Fragment )
- android 项目学习随笔十四(WebView)
- android 项目学习随笔十九(MD5)
- Android学习之随笔(一)
- 录音项目随笔(一)
- android 项目学习随笔二(引导页 )
- android 项目学习随笔四(优化ViewPager)
- android 项目学习随笔五(JSON解析)
- android 项目学习随笔六(网络缓存)
- android 项目学习随笔七(ViewPagerIndicator与ViewPager)
- android 项目学习随笔八(xUtils的BitmapUtils模块)
- android 项目学习随笔九(ListView加头布局)
- android 项目学习随笔十(自定义ProgressBar)
- android 项目学习随笔十一(ListView下拉刷新提示)
- android 项目学习随笔十二(ListView加脚布局)
- android 项目学习随笔十五(ShareSDK开放平台)
- android 项目学习随笔十八(三级缓存)
- android 学习随笔二十七(JNI:Java Native Interface,JAVA原生接口 )
- android 学习随笔二十八(应用小知识点小结 )
- K-means聚类算法及其各种变形模型的实验分析
- android 学习随笔二十九(自定义监听 )
- 微信小程序
- android 项目学习随笔一(闪屏 )
- android 项目学习随笔二(引导页 )
- Android应用开发SharedPreferences存储数据的使用方法
- setfenv
- button改变背景与文字颜色
- android 项目学习随笔三(Fragment )
- 洛谷 P1463 [SDOI2005]反素数ant
- android 项目学习随笔四(优化ViewPager)
- android 项目学习随笔五(JSON解析)