嘿,我有以下问题,我动画我的浮动按钮 - 即他们正在严重缩放。首先,第二张图像上的制作按钮比它们应该高。事件主浮动按钮带" +"不旋转。我有人知道如何处理它请回答我。
图像离开HTC One MAX,屏幕高清 - SKD21 lolipop,模拟器768x1280 SKD 17果冻豆
我在Activity.PhotoGallery中的代码
private void showFabs(){
动画show_fab_photo = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_add_photo_show);
FrameLayout.LayoutParams layoutParams =(FrameLayout.LayoutParams)fabAddPhoto.getLayoutParams();
layoutParams.bottomMargin + =(int)(fabAddPhoto.getHeight()* 1.7);
fabAddPhoto.setLayoutParams(的LayoutParams);
fabAddPhoto.startAnimation(show_fab_photo);
fabAddPhoto.setClickable(真);
动画show_fab_gallery = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_add_from_gallery_show);
FrameLayout.LayoutParams layoutParamsGallery =(FrameLayout.LayoutParams)fabAddFromGallery.getLayoutParams();
layoutParamsGallery.bottomMargin + =(int)(fabAddFromGallery.getHeight()* 3.4);
fabAddFromGallery.setLayoutParams(layoutParamsGallery);
fabAddFromGallery.startAnimation(show_fab_gallery);
fabAddFromGallery.setClickable(真);
动画rotateFabAdd = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_gallery_show);
fabAdd.startAnimation(rotateFabAdd);
}
private void hideFabs(){
动画hide_fab_photo = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_add_photo_hide);
FrameLayout.LayoutParams layoutParams =(FrameLayout.LayoutParams)fabAddPhoto.getLayoutParams();
layoutParams.bottomMargin - =(int)(fabAddPhoto.getHeight()* 1.7);
fabAddPhoto.setLayoutParams(的LayoutParams);
fabAddPhoto.startAnimation(hide_fab_photo);
fabAddPhoto.setClickable(假);
动画hide_fab_gallery = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_add_from_gallery_hide);
FrameLayout.LayoutParams layoutParamsGallery =(FrameLayout.LayoutParams)fabAddFromGallery.getLayoutParams();
layoutParamsGallery.bottomMargin - =(int)(fabAddFromGallery.getHeight()* 3.4);
fabAddFromGallery.setLayoutParams(layoutParamsGallery);
fabAddFromGallery.startAnimation(hide_fab_gallery);
fabAddFromGallery.setClickable(假);
动画rotateFabAdd = AnimationUtils.loadAnimation(getApplication(),R.anim.fab_gallery_hide);
fabAdd.startAnimation(rotateFabAdd);
}
而我的动画XML文件
Fab用相机
<?xml version =" 1.0"编码=" UTF-8">
< set xmlns:android =" http://schemas.android.com/apk/res/android"
机器人:fillAfter ="真">
<! - 旋转 - >
<旋转
机器人:持续时间=" 500"
机器人:fromDegrees =" 30"
机器人:内插器=" @android:动画/ linear_interpolator"
机器人:pivotX =" 50%"
机器人:pivotY =" 50%"
机器人:repeatCount =" 0"
机器人:REPEATMODE ="反向"
机器人:toDegrees =" 0">< /旋转>
<! - 移动 - >
<翻译
机器人:持续时间=" 800"
机器人:fromXDelta =" 0%"
机器人:fromYDelta =" 170%"
机器人:内插器=" @android:动画/ linear_interpolator"
机器人:toXDelta =" 0%"
机器人:toYDelta =" 0%">< /翻译>
<! - 淡入 - >
<阿尔法
机器人:持续时间=" 1500"
机器人:fromAlpha =" 0.0"
机器人:内插器=" @android:动画/ decelerate_interpolator"
机器人:toAlpha =" 1.0">< /α->
< /集>
Fab与图像
<?xml version =" 1.0"编码=" UTF-8">
< set xmlns:android =" http://schemas.android.com/apk/res/android"
机器人:fillAfter ="真">
<! - 旋转 - >
<旋转
机器人:持续时间=" 500"
机器人:fromDegrees =" 30"
机器人:内插器=" @android:动画/ linear_interpolator"
机器人:pivotX =" 50%"
机器人:pivotY =" 50%"
机器人:repeatCount =" 0"
机器人:REPEATMODE ="反向"
机器人:toDegrees =" 0">< /旋转>
<! - 移动 - >
<翻译
机器人:持续时间=" 800"
机器人:fromXDelta =" 0%"
机器人:fromYDelta =" 340%"
机器人:内插器=" @android:动画/ linear_interpolator"
机器人:toXDelta =" 0%"
机器人:toYDelta =" 0%">< /翻译>
<! - 淡入 - >
<阿尔法
机器人:持续时间=" 1500"
机器人:fromAlpha =" 0.0"
机器人:内插器=" @android:动画/ decelerate_interpolator"
机器人:toAlpha =" 1.0">< /α->
< /集>