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 ...
随机推荐
- Ioc-Autofac的使用
serveral IoC Framework has already exist on the market,Take account of compenhensive factor,Autofa ...
- 由单例模式学到:Lazy<T>
http://www.cnblogs.com/zhangpengshou/archive/2012/12/10/2811765.html http://www.cnblogs.com/anytao/a ...
- Android仿QQ窗口的抖动的动画效果
就是仿照QQ窗口的抖动效果,在项目的res下创建anim文件夹,再创建两个xml文件:cycle.xml . myanim.xml cycle.xml : <?xml version ...
- WebDriver中启动不同的浏览器
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; im ...
- mysql 模块使用
import MySQLdb conn = MySQLdb.connect(host=',db='fengjian') cur = conn.cursor() sql = 'insert into a ...
- Vue.2.0.5-模板语法
Vue.js 使用了基于 HTML 的模版语法,允许开发者声明式地将 DOM 绑定至底层 Vue 实例的数据.所有 Vue.js 的模板都是合法的 HTML ,所以能被遵循规范的浏览器和 HTML 解 ...
- TCP/IP之TCP的建立与终止
TCP协议简介 tcp/ip协议族中传输层最重要的两种协议是UDP和TCP协议,上一篇文章用很短的篇幅介绍完了UDP协议相关的内容,但相对于UDP而言的TCP协议,是种更复杂,应用更广的协议.在接下来 ...
- 解决: libcimtd.lib not found, rpcndr.lib not found
在编译Inside COM这本书的代码的时候. 报这个错. 毕竟1996年的代码... 原因很简单: libcimtd.lib 是 VC6时代的东西(对应着iostream.h)...现在的MS编译器 ...
- 自动档车的P档和N档的区别
P档时,驻车齿轮在变速箱内被部分锁死,所以此时平地上不踩刹车,车辆有一定的驻车效果.N档就是空档,发动机与传动轴在变速器位置彻底分离,没有连接.因此P档适合停车和驻车,就是到地方了,要熄火时挂P档,拉 ...
- 转:Python一些特殊用法(map、reduce、filter、lambda、列表推导式等)
Map函数: 原型:map(function, sequence),作用是将一个列表映射到另一个列表, 使用方法: def f(x): return x**2 l = range(1,10) map( ...