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 ...
随机推荐
- dede完美分页样式
html <div class="dede_pages"> <ul class="pagelist"> ...
- [BS-18] 对OC中不可变类的理解
对OC中不可变类的理解 OC中存在很多不可变的类(如NSString,NSAttributedString,NSArray,NSDictionary,NSSet等),用它们创建的对象存在于堆内存中,但 ...
- 获取启动画面图片的string
支持 iPhone 以下. 支持 iPhone 及 iPad +(NSString*)getLaunchImageName { NSArray* images= @[@"LaunchImag ...
- ios-控件的frame_center_bounds简单介绍
frame 例如一个button按钮控件的frame frame是一个结构体,frame表示了button在它的父控件view中的位置---origin 以及---size origin也是一个结构体 ...
- IntelliJ IDEA 显示行号方法
设置方法如下: File->Settings->Editor->General->Appearence->Show Line Number
- 避免硬编码你的PostgreSQL数据库密码
一个密码文件包含了我们需要连接的五个字段,所以我们可以使用文件权限来使密码更安全. host:port:dbname:user:password such as myhost:5432:postgre ...
- G面经prepare: X-Straight
Define “X-Straight” as X cards with consecutive numbers (X >= 3). Determine if the deck can be fu ...
- SLF4简介
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logg ...
- Python学习总结8:文件模式及操作方法汇总
文件操作之前需要文件保证文件存在,并且将文件open os.mknod("test.txt") 创建空文件 fp = open("test.txt" ...
- paper 85:机器统计学习方法——CART, Bagging, Random Forest, Boosting
本文从统计学角度讲解了CART(Classification And Regression Tree), Bagging(bootstrap aggregation), Random Forest B ...