package com.ljp.pathmenu;
import android.content.Context;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnticipateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageButton;
public class MyAnimations{
private static int xOffset = 15;
private static int yOffset = -13;
public static void initOffset(Context context){//由布局文件
xOffset = (int) (10.667 *context.getResources().getDisplayMetrics().density);
yOffset = -(int) (8.667 *context.getResources().getDisplayMetrics().density);
}
public static Animation getRotateAnimation(float fromDegrees ,float toDegrees,int durationMillis){
RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(durationMillis);
rotate.setFillAfter(true);
return rotate;
}
public static void startAnimationsIn(ViewGroup viewgroup,int durationMillis) {
for (int i = 0; i < viewgroup.getChildCount(); i++) {
ImageButton inoutimagebutton = (ImageButton) viewgroup
.getChildAt(i);
inoutimagebutton.setVisibility(0);
MarginLayoutParams mlp = (MarginLayoutParams) inoutimagebutton.getLayoutParams();
Animation animation = new TranslateAnimation(mlp.rightMargin-xOffset,0F,yOffset + mlp.bottomMargin, 0F);
animation.setFillAfter(true);animation.setDuration(durationMillis);
animation.setStartOffset((i * 100)
/ (-1 + viewgroup.getChildCount()));
animation.setInterpolator(new OvershootInterpolator(2F));
inoutimagebutton.startAnimation(animation);
}
}
public static void startAnimationsOut(ViewGroup viewgroup,int durationMillis) {
for (int i = 0; i < viewgroup.getChildCount(); i++) {
final ImageButton inoutimagebutton = (ImageButton) viewgroup
.getChildAt(i);
MarginLayoutParams mlp = (MarginLayoutParams) inoutimagebutton.getLayoutParams();
Animation animation = new TranslateAnimation(0F,mlp.rightMargin-xOffset, 0F,yOffset + mlp.bottomMargin);
animation.setFillAfter(true);animation.setDuration(durationMillis);
animation.setStartOffset(((viewgroup.getChildCount()-i) * 100)
/ (-1 + viewgroup.getChildCount()));//顺序倒一下比较舒服
animation.setInterpolator(new AnticipateInterpolator(2F));
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation arg0) {}
@Override
public void onAnimationRepeat(Animation arg0) {}
@Override
public void onAnimationEnd(Animation arg0) {
// TODO Auto-generated method stub
inoutimagebutton.setVisibility(8);
}
});
inoutimagebutton.startAnimation(animation);
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
原来PATH的菜单效果如此简单。布局+TranslateAnimation搞定
共52个文件
png:24个
class:12个
xml:5个
3星 · 超过75%的资源 需积分: 11 27 下载量 101 浏览量
2015-10-09
15:55:34
上传
评论
收藏 1.3MB ZIP 举报
温馨提示
原来PATH的菜单效果如此简单。布局+TranslateAnimation搞定,源码0分下载了
资源推荐
资源详情
资源评论
收起资源包目录
原来PATH的菜单效果如此简单。布局+TranslateAnimation搞定.zip (52个子文件)
PathMenu
.project 844B
project.properties 360B
proguard.cfg 1KB
src
com
ljp
pathmenu
MyAnimations.java 3KB
PathMenuActivity.java 2KB
AndroidManifest.xml 737B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
composer_sun.png 4KB
composer_button.png 3KB
composer_place.png 3KB
ic_launcher.png 4KB
composer_thought.png 2KB
composer_sleep.png 3KB
default_homebg.jpg 427KB
composer_camera.png 2KB
composer_with.png 3KB
composer_icn_plus.png 164B
composer_music.png 3KB
drawable-mdpi
ic_launcher.png 3KB
layout
main.xml 4KB
anim
rotate_in.xml 364B
rotate_out.xml 364B
values
strings.xml 182B
assets
gen
com
ljp
pathmenu
R.java 2KB
.classpath 364B
bin
resources.ap_ 461KB
PathMenu.apk 467KB
classes
com
ljp
pathmenu
R$layout.class 388B
R$drawable.class 785B
PathMenuActivity.class 2KB
R$attr.class 334B
PathMenuActivity$2.class 786B
PathMenuActivity$1.class 2KB
R$id.class 788B
R$anim.class 421B
R.class 561B
R$string.class 421B
MyAnimations.class 3KB
MyAnimations$1.class 1KB
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
composer_sun.png 1KB
composer_button.png 3KB
composer_place.png 3KB
ic_launcher.png 4KB
composer_thought.png 2KB
composer_sleep.png 3KB
composer_camera.png 2KB
composer_with.png 3KB
composer_icn_plus.png 164B
composer_music.png 3KB
drawable-mdpi
ic_launcher.png 2KB
classes.dex 8KB
共 52 条
- 1
资源评论
- 一页清风2015-10-09下载后不能正常使用
lkkl1977
- 粉丝: 4
- 资源: 201
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 第十四届中北大学ACM程序设计竞赛.zip
- UIGF_200852355_202404242026.json
- 基于深度学习的对话系统、语音识别、机器翻译和语音合成等
- 基于STM32单片机的智能停车场设计源码+全部资料.zip
- 534springboot + vue 实验室管理系统.zip(可运行源码+数据库文件+文档)
- 基于Python+Opencv+keras的实时手势识别系统+源码+文档(期末大作业&课程设计&项目开发)
- 基于Python+joint-spider爬虫数据的成都二手房数据分析源码+详细使用说明.zip
- 基于YOLOv7-plate和CRNN的车牌号检测识别项目,使用PyQt构建了UI界面
- 基于LabView+MATLAB的说话人识别系统.zip
- 基于树莓派+OpenCV+Python语言的人脸识别+源码+开发文档(毕业设计&课程设计&项目开发)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功