动画瞎写
2016-01-29 13:58
169 查看
1.引导页添加一个透明度由暗变量,放大的效果。
xml代码》activity_start.xml
anim/下建立一个guide_welcome_fade_in_scale.xml文件。
java代码》
xml代码》activity_start.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".StartActivity" android:id="@+id/rel_start_bg"> </RelativeLayout>
anim/下建立一个guide_welcome_fade_in_scale.xml文件。
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" > <scale android:fromXScale="1.0" android:fromYScale="1.0" android:interpolator="@android:anim/decelerate_interpolator" android:pivotX="50.0%" android:pivotY="50.0%" android:toXScale="1.1" android:toYScale="1.1"/> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" /> /> </set>
java代码》
private RelativeLayout rel_start_bg; private Animation mFadeInScale; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final View view= View.inflate(this, R.layout.activity_start, null); setContentView(view); initAnim(); rel_start_bg=(RelativeLayout)findViewById(R.id.rel_start_bg); rel_start_bg.setBackgroundResource(R.drawble.bg_start); rel_start_bg.startAnimation(mFadeInScale); setListener(); } private void initAnim() { mFadeInScale = AnimationUtils.loadAnimation(this, R.anim.guide_welcome_fade_in_scale); mFadeInScale.setFillAfter(true); } private void setListener() { mFadeInScale.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { //此处可跳入首页 } }); }
相关文章推荐
- Excel中将字符串中从右起第n个指定字符替换的方法
- Sql优化-必劳记!
- servlet基础
- UITableView头部的图片,下拉缩放
- Java Code Examples for org.apache.commons.codec.binary.Base64InputStream
- 大数据量时Mysql的优化要点
- java学习之路
- 对称加密和分组加密中的四种模式(ECB、CBC、CFB、OFB)
- 代码混淆配置
- STL_算法_根据第n个元素排序(nth_element)
- windowSoftInputMode键盘把输入框挡住了
- [Leetcode]146. LRU Cache @python
- Android NDK生成so文件
- 使用poi通过excel模板导出excel数据
- perl AnyEvent
- Android手机实时视频监控
- Matlab---串口操作---数据採集篇
- 分组后取每组内排名的Top N的SQL语句
- 店铺如何用视觉走出差异化?
- linq语法大全(转集)